This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Dataclasses test doesn't run independently
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Lib/test/test_dataclasses.py failed when ran as a script
View: 34184
Assigned To: Nosy List: kayhayen, serhiy.storchaka
Priority: normal Keywords:

Created on 2018-07-28 16:01 by kayhayen, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg322570 - (view) Author: Kay Hayen (kayhayen) Date: 2018-07-28 16:01
When I run:

python3.7 test/test_dataclasses.py

======================================================================
ERROR: test_classvar_module_level_import (__main__.TestStringAnnotations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/hayen/repos/Py2C/tests/CPython37/test/test_dataclasses.py", line 2716, in test_classvar_module_level_import
    from . import dataclass_module_1
ImportError: cannot import name 'dataclass_module_1' from '__main__' (/home/hayen/repos/Py2C/tests/CPython37/test/test_dataclasses.py)

======================================================================
FAIL: test_no_repr (__main__.TestRepr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/hayen/repos/Py2C/tests/CPython37/test/test_dataclasses.py", line 1970, in test_no_repr
    repr(C(3)))
AssertionError: 'test_dataclasses.TestRepr.test_no_repr.<locals>.C object at' not found in '<__main__.TestRepr.test_no_repr.<locals>.C object at 0x7f6a2d4ffd68>'

The relative imports cannot work, as the main program is not in the test package. Also it has the name __main__ not the module name in repr.

As Guido said in another bug report, tests are expected to pass. Can you please adapt them?

I hope "Library" is proper component, as tests are below it.

Thanks,
Kay
msg322574 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-07-28 16:07
Looks as a duplicate of issue34184.
msg322581 - (view) Author: Kay Hayen (kayhayen) Date: 2018-07-28 17:51
Totally is. Closing, sorry for not seeing that one myself.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78446
2018-07-28 19:30:52serhiy.storchakasetsuperseder: Lib/test/test_dataclasses.py failed when ran as a script
resolution: duplicate
2018-07-28 17:51:47kayhayensetstatus: open -> closed

messages: + msg322581
stage: resolved
2018-07-28 16:07:30serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg322574
2018-07-28 16:01:36kayhayencreate