Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
339f260
gh-108927: Do not remove tested modules from sys.modules
serhiy-storchaka Sep 5, 2023
e52be9b
Update NEWS entry.
serhiy-storchaka Sep 5, 2023
68c014e
Fix unloading the newly imported modules after testing.
serhiy-storchaka Sep 6, 2023
c1ad70c
Merge branch 'main' into regretest-no-remove-test-module
serhiy-storchaka Sep 12, 2023
3f25ab4
Add tests.
serhiy-storchaka Sep 12, 2023
7673248
Update Misc/NEWS.d/next/Tests/2023-09-05-20-46-35.gh-issue-108927.Tpw…
serhiy-storchaka Sep 12, 2023
5df4c8b
Move save/unload modules down in single.py.
serhiy-storchaka Sep 13, 2023
eb7766b
Merge branch 'main' into regretest-no-remove-test-module
serhiy-storchaka Sep 13, 2023
0eae535
Refactoring.
serhiy-storchaka Sep 13, 2023
66437b5
Remove also attributes from parent modules.
serhiy-storchaka Sep 13, 2023
8470b33
Merge branch 'main' into regretest-no-remove-test-module
serhiy-storchaka Oct 14, 2023
544c068
Merge branch 'main' into regretest-no-remove-test-module
serhiy-storchaka Nov 27, 2023
1e7ea34
Merge branch 'main' into regretest-no-remove-test-module
serhiy-storchaka Nov 28, 2023
56621ab
Only unload modules if run tests sequentially.
serhiy-storchaka Nov 28, 2023
ba5597a
Apply suggestions from code review
serhiy-storchaka Dec 1, 2023
d025e22
Merge branch 'main' into regretest-no-remove-test-module
serhiy-storchaka Dec 4, 2023
1aae341
Add a comment.
serhiy-storchaka Dec 4, 2023
017f01d
Test that test modules are really unloaded.
serhiy-storchaka Dec 4, 2023
5086405
Merge remote-tracking branch 'refs/remotes/origin/regretest-no-remove…
serhiy-storchaka Dec 4, 2023
b3ea8fa
Update Lib/test/test_regrtest.py
serhiy-storchaka Dec 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests.
  • Loading branch information
serhiy-storchaka committed Sep 12, 2023
commit 3f25ab447a52d9102c3004666366878adf97cd7f
6 changes: 6 additions & 0 deletions Lib/test/regrtestdata/import_from_tests/test_regrtest_a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest
import test_regrtest_b.util

class Test(unittest.TestCase):
def test(self):
test_regrtest_b.util
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import unittest

class Test(unittest.TestCase):
def test(self):
pass
Empty file.
6 changes: 6 additions & 0 deletions Lib/test/regrtestdata/import_from_tests/test_regrtest_c.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest
import test_regrtest_b.util

class Test(unittest.TestCase):
def test(self):
test_regrtest_b.util
8 changes: 8 additions & 0 deletions Lib/test/test_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,14 @@ def test_random_seed(self):
def test_random_seed_workers(self):
self._check_random_seed(run_workers=True)

def test_import_from_tests(self):
Comment thread
serhiy-storchaka marked this conversation as resolved.
Outdated
testdir = os.path.join(os.path.dirname(__file__),
'regrtestdata', 'import_from_tests')
tests = [f'test_regrtest_{name}' for name in ('a', 'b', 'c')]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to add a comment to explain the purpose of these test? By reading the code, it's unclear to me. Explain that the test execution order matters for this test.

Does the test fails if a regression is introduced? Maybe add a test_regrtest_d test checking if test_regrtest_a, test_regrtest_b and test_regrtest_c are not loaded?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

args = ['-Wd', '-E', '-bb', '-m', 'test', '--testdir=%s' % testdir, *tests]
output = self.run_python(args)
self.check_executed_tests(output, tests, stats=3)


class TestUtils(unittest.TestCase):
def test_format_duration(self):
Expand Down