GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Running test_dataclasses file directly fails · Issue #104015 · python/cpython

Running test_dataclasses file directly fails #104015

New issue
Copy link
New issue
Copy link
Closed
#104017
Closed
Running test_dataclasses file directly fails#104015
#104017
Copy link
Assignees
sobolevn
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

Description

@wookie184
wookie184
opened on Apr 30, 2023
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

  • gh-104015: Fix direct invocation of test_dataclasses #104017

Activity

  1. wookie184
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 30, 2023
  2. AlexWaygood
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Apr 30, 2023
  3. AlexWaygood commented on Apr 30, 2023

    @AlexWaygood
    AlexWaygood
    on Apr 30, 2023
    Member
    More actions

    The problematic tests were added relatively recently, in b48be8f (cc. @sobolevn)

  4. AlexWaygood
    added
    3.12only security fixesonly security fixes
    on Apr 30, 2023
  5. sobolevn commented on Apr 30, 2023

    @sobolevn
    sobolevn
    on Apr 30, 2023
    Member
    More actions

    I will take a look, thanks!

    Reacted by Alex Waygood
  6. sobolevn
    self-assigned this
    on Apr 30, 2023
  7. sobolevn
    added a commit that references this issue on Apr 30, 2023

    pythongh-104015: Fix direct invokation of `test_dataclasses`

    13dd5e4
  8. AlexWaygood
    closed this as completedin #104017on Apr 30, 2023
  9. AlexWaygood
    added a commit that references this issue on Apr 30, 2023

    gh-104015: Fix direct invocation of `test_dataclasses` (#104017)

    654d44b
  10. carljm
    added a commit that references this issue on May 1, 2023

    Merge branch 'main' into supermon

    159b2aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @sobolevn
    sobolevn

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

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.