Skip to content

test_pickle tests failing when invoked directly #131031

Closed
@donBarbos

Description

@donBarbos

I ran separate tests for the pickle module on main branch:

./python ./Lib/test/test_pickle.py

I got 24 failures
Judging by the output, the problem is in the mismatch of error messages:

test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) ...
  test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) (proto=0) ... FAIL
  test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) (proto=1) ... FAIL
  test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) (proto=2) ... FAIL
  test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) (proto=3) ... FAIL
  test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) (proto=4) ... FAIL
  test_nested_lookup_error (__main__.CPicklingErrorTests.test_nested_lookup_error) (proto=5) ... FAIL
...
test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) ...
  test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) (proto=0) ... FAIL
  test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) (proto=1) ... FAIL
  test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) (proto=2) ... FAIL
  test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) (proto=3) ... FAIL
  test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) (proto=4) ... FAIL
  test_wrong_object_lookup_error (__main__.CPicklingErrorTests.test_wrong_object_lookup_error) (proto=5) ... FAIL
...
test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) ...
  test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) (proto=0) ... FAIL
  test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) (proto=1) ... FAIL
  test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) (proto=2) ... FAIL
  test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) (proto=3) ... FAIL
  test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) (proto=4) ... FAIL
  test_nested_lookup_error (__main__.PyPicklingErrorTests.test_nested_lookup_error) (proto=5) ... FAIL
...
test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) ...
  test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) (proto=0) ... FAIL
  test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) (proto=1) ... FAIL
  test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) (proto=2) ... FAIL
  test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) (proto=3) ... FAIL
  test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) (proto=4) ... FAIL
  test_wrong_object_lookup_error (__main__.PyPicklingErrorTests.test_wrong_object_lookup_error) (proto=5) ... FAIL

Examples of mismatches:

AssertionError: "type object 'AbstractPickleTests' has no attribute 'spam'" != "module '__main__' has no attribute 'AbstractPickleTests'"
- type object 'AbstractPickleTests' has no attribute 'spam'
+ module '__main__' has no attribute 'AbstractPickleTests'
...
AssertionError: "Can'[53 chars]4b0>: it's not the same object as __main__.AbstractPickleTests" != "Can'[53 chars]4b0>: it's not found as __main__.AbstractPickleTests"
- Can't pickle <test.pickletester.REX object at 0x79fcb255a4b0>: it's not the same object as __main__.AbstractPickleTests
?                                                                         ^^^^^^^^^ ^^^^^
+ Can't pickle <test.pickletester.REX object at 0x79fcb255a4b0>: it's not found as __main__.AbstractPickleTests
?

I'm going to send PR after we decide what the messages should look like

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions