diff options
author | Andrey Bienkowski <hexagonrecursion@gmail.com> | 2021-01-26 15:58:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-26 15:58:33 (GMT) |
commit | d863deeff27f00ac33e9f169d23ca56d69af3f86 (patch) | |
tree | c2d377f1efe22ee5965463c026caa53fcf1bc053 /Lib/test/test_pdb.py | |
parent | c10180ea1458aa0ffd7793cb75629ebffe8a257e (diff) | |
download | cpython-d863deeff27f00ac33e9f169d23ca56d69af3f86.zip cpython-d863deeff27f00ac33e9f169d23ca56d69af3f86.tar.gz cpython-d863deeff27f00ac33e9f169d23ca56d69af3f86.tar.bz2 |
[3.8] bpo-42383: pdb: do not fail to restart the target if the current directory changed (GH-23412) (#24323)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r-- | Lib/test/test_pdb.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 7444874..f77c355 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1699,6 +1699,29 @@ def bœr(): self.assertEqual(stdout.split('\n')[2].rstrip('\r'), expected) + def test_issue42383(self): + with support.temp_cwd() as cwd: + with open('foo.py', 'w') as f: + s = textwrap.dedent(""" + print('The correct file was executed') + + import os + os.chdir("subdir") + """) + f.write(s) + + subdir = os.path.join(cwd, 'subdir') + os.mkdir(subdir) + os.mkdir(os.path.join(subdir, 'subdir')) + wrong_file = os.path.join(subdir, 'foo.py') + + with open(wrong_file, 'w') as f: + f.write('print("The wrong file was executed")') + + stdout, stderr = self._run_pdb(['foo.py'], 'c\nc\nq') + expected = '(Pdb) The correct file was executed' + self.assertEqual(stdout.split('\n')[6].rstrip('\r'), expected) + def load_tests(*args): from test import test_pdb |