Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with test unit: cannot import name KW_ONLY from dataclasses #134

Open
rodolakis opened this issue Jun 3, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@rodolakis
Copy link
Collaborator

I tried to add some test data and the test unit failed:

Run xvfb-run pytest -vvv .
  xvfb-run pytest -vvv .
  shell: /usr/bin/bash -l {0}
  env:
    DISPLAY: :99.0
    MAMBA_ROOT_PREFIX: /home/runner/micromamba
    MAMBA_EXE: /home/runner/micromamba-bin/micromamba
    CONDARC: /home/runner/work/_temp/setup-micromamba/.condarc
============================= test session starts ==============================
platform linux -- Python 3.9.19, pytest-8.[2](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:2).1, pluggy-1.5.0 -- /home/runner/micromamba/envs/anaconda-test-env-py-[3](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:3).9/bin/python3.9
cachedir: .pytest_cache
PyQt5 5.15.9 -- Qt runtime 5.15.8 -- Qt compiled 5.15.8
rootdir: /home/runner/work/mdaviz/mdaviz
configfile: pyproject.toml
plugins: cov-5.0.0, qt-[4](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:4).4.0, xvfb-3.0.0, anyio-4.3.0
collecting ... collected 2 items

mdaviz/tests/test_aboutdialog.py::test_about_starts PASSED               [ [5](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:5)0%]
mdaviz/tests/test_app.py::test_app_startup FAILED                        [100%]

=================================== FAILURES ===================================
_______________________________ test_app_startup _______________________________
CALL ERROR: Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mainwindow.py", line 270, in setSubFolderPath
    self.mvc_folder = MDA_MVC(self)
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_folder.py", line 101, in __init__
    self.setup()
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_folder.py", line 107, in setup
    from .mda_file import MDAFile
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file.py", line 34, in <module>
    from .mda_file_table_view import MDAFileTableView
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file_table_view.py", line 1[6](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:6), in <module>
    from .mda_file_table_model import ColumnDataType
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file_table_model.py", line 34, in <module>
    from dataclasses import KW_ONLY
ImportError: cannot import name 'KW_ONLY' from 'dataclasses' (/home/runner/micromamba/envs/anaconda-test-env-py-3.9/lib/python3.9/dataclasses.py)
________________________________________________________________________________
----------------------------- Captured stdout call -----------------------------
Settings are saved in: /home/runner/.config/BCDA-APS/mdaviz.ini
----------------------------- Captured stderr call -----------------------------
Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mainwindow.py", line 2[7](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:7)0, in setSubFolderPath
    self.mvc_folder = MDA_MVC(self)
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_folder.py", line 101, in __init__
    self.setup()
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_folder.py", line 107, in setup
    from .mda_file import MDAFile
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file.py", line 34, in <module>
    from .mda_file_table_view import MDAFileTableView
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file_table_view.py", line 16, in <module>
    from .mda_file_table_model import ColumnDataType
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file_table_model.py", line 34, in <module>
    from dataclasses import KW_ONLY
ImportError: cannot import name 'KW_ONLY' from 'dataclasses' (/home/runner/micromamba/envs/anaconda-test-env-py-3.[9](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:10)/lib/python3.9/dataclasses.py)
________________________________________________________________________________
=============================== warnings summary ===============================
../../../micromamba/envs/anaconda-test-env-py-3.9/lib/python3.9/site-packages/setuptools_scm/git.py:167
  /home/runner/micromamba/envs/anaconda-test-env-py-3.9/lib/python3.9/site-packages/setuptools_scm/git.py:167: UserWarning: "/home/runner/work/mdaviz/mdaviz" is shallow and may cause errors
    warnings.warn(f'"{wd.path}" is shallow and may cause errors')

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED mdaviz/tests/test_app.py::test_app_startup - Failed: CALL ERROR: Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mainwindow.py", line 270, in setSubFolderPath
    self.mvc_folder = MDA_MVC(self)
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_folder.py", line [10](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:11)1, in __init__
    self.setup()
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_folder.py", line 107, in setup
    from .mda_file import MDAFile
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file.py", line 34, in <module>
    from .mda_file_table_view import MDAFileTableView
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file_table_view.py", line [16](https://github.com/BCDA-APS/mdaviz/actions/runs/9340518196/job/25706174812#step:8:17), in <module>
    from .mda_file_table_model import ColumnDataType
  File "/home/runner/work/mdaviz/mdaviz/mdaviz/mda_file_table_model.py", line 34, in <module>
    from dataclasses import KW_ONLY
ImportError: cannot import name 'KW_ONLY' from 'dataclasses' (/home/runner/micromamba/envs/anaconda-test-env-py-3.9/lib/python3.9/dataclasses.py)
________________________________________________________________________________
==================== 1 failed, 1 passed, 1 warning in 1.01s ====================
Error: Process completed with exit code 1.
@rodolakis rodolakis added the enhancement New feature or request label Jun 3, 2024
@rodolakis rodolakis self-assigned this Jun 3, 2024
@rodolakis rodolakis added this to mdaviz Jun 3, 2024
@rodolakis
Copy link
Collaborator Author

For now I have remove the mda files from the tests/test_data folder

@rodolakis rodolakis moved this to In Progress in mdaviz Jun 3, 2024
@rodolakis rodolakis moved this from In Progress to v1.1 in mdaviz Jun 3, 2024
@rodolakis rodolakis added this to the v1.1 milestone Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Upgrades
Development

No branches or pull requests

1 participant