New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDLE: test_browser is failed when run twice #75740
Comments
Buildbots failures: http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.x/builds/101/steps/test/logs/stdio I don't know why test_browser fails first time, but this provokes running it second time why always fails. $ ./python -m test -vuall -m test_browser test_idle test_idle
... ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython3.6/Lib/idlelib/idle_test/test_browser.py", line 181, in test_gettext
self.assertEqual(self.cbt_C1.GetText(), 'class C1')
AssertionError: 'class C1()' != 'class C1'
- class C1()
? --
+ class C1 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython3.6/Lib/idlelib/idle_test/test_browser.py", line 175, in test_init
eq(self.cbt_C1.name, 'C1')
AssertionError: 'C1()' != 'C1'
- C1()
? --
+ C1 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython3.6/Lib/idlelib/idle_test/test_browser.py", line 141, in test_getsublist
self.assertEqual(sub1.name, 'C0')
AssertionError: 'C0(base)' != 'C0'
- C0(base)
+ C0 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython3.6/Lib/idlelib/idle_test/test_browser.py", line 238, in test_nested
self.assertEqual(actual_names, expected_names)
AssertionError: Lists differ: ['f0', 'C0(base)', 'f1', 'c1', 'F1', 'C1()', 'f2', 'C2', 'F3'] != ['f0', 'C0', 'f1', 'c1', 'F1', 'C1()', 'f2', 'C2', 'F3'] First differing element 1:
+ ['f0', 'C0', 'f1', 'c1', 'F1', 'C1()', 'f2', 'C2', 'F3'] ---------------------------------------------------------------------- The test is passed if run it once on my computer. |
browser.transform_children, when called the first time on a dict of children nodes, rebinds the name attribute of Classes with bases*. Tests that called the real browser.transform_children the first time on a node mutate the global mock_pyclbr_tree. When the tests are re-run in the same process, tests initially run before the mutation are also run after the mutation. *This is not an issue in current real use. IDLE gets a new tree each time a module browser is opened. The current tree widget calls GetSublist and hence transform_children at most once per node as it caches the result for each node. But don't know what ttk.Treeview does and do know that tests can make multiple calls. Restoring the tree with Instead, I added immediate calls to transform_children so that the mock tree is never mutated thereafter by any of the tests. The subsequent class checks that the initial name replacements are correct. All tests see the tree in the same state, so there should not be any order dependence left. Testing global function calls in a testcase is slightly awkward, but the testcase follows immediately, and making the tree and its nodes global simplifies the tests that use the tree. I checked that running test_pyclbr and test_idle twice each succeeds. |
On both buildbots, the initial rerun passes: |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: