[New-bugs-announce] [issue34265] Dataclasses test doesn't run independently

Kay Hayen report at bugs.python.org
Sat Jul 28 12:01:36 EDT 2018


New submission from Kay Hayen <kay.hayen at gmail.com>:

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

----------
components: Library (Lib)
messages: 322570
nosy: kayhayen
priority: normal
severity: normal
status: open
title: Dataclasses test doesn't run independently
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34265>
_______________________________________


More information about the New-bugs-announce mailing list