Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Running test_dataclasses file directly fails #104015

Copy link
Copy link
Closed
@wookie184

Description

@wookie184
Issue body actions

Bug report

Running ./python Lib/test/test_dataclasses.py gives me these test fails:

[root@codespaces-44977f cpython]# ./python Lib/test/test_dataclasses.py
....................................................................................................................................................................................EEEEEE...................................................
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=0)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
    pickle.loads(pickle.dumps(klass, proto)),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass

======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
    pickle.loads(pickle.dumps(klass, proto)),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass

======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
    pickle.loads(pickle.dumps(klass, proto)),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass

======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=3)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
    pickle.loads(pickle.dumps(klass, proto)),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass

======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=4)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
    pickle.loads(pickle.dumps(klass, proto)),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass

======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=5)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
    pickle.loads(pickle.dumps(klass, proto)),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass

----------------------------------------------------------------------
Ran 232 tests in 0.408s

FAILED (errors=6)

When running ./python -m test test_dataclasses, the tests all pass successfully. My understanding is that python -m test is the recommended way of running tests, but it's confusing to have it support running the file directly, but have the tests fail.

I'm not sure what the cause of the failure is.

Your environment

  • CPython versions tested on: main (ed95e8c)
  • Operating system and architecture: GitHub Codespaces

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixesonly security fixestestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.