- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.3k
gh-80744: do not read .pdbrc twice when cwd == $home #136816
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
d4c6872
              53613ef
              64b7a1a
              623d54d
              b8bb7a9
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -3935,6 +3935,25 @@ def test_readrc_homedir(self): | |
| f.write("invalid") | ||
| self.assertEqual(pdb.Pdb().rcLines[0], "invalid") | ||
|  | ||
| def test_readrc_current_dir(self): | ||
| with os_helper.temp_cwd() as cwd: | ||
| rc_path = os.path.join(cwd, ".pdbrc") | ||
| with open(rc_path, "w") as f: | ||
| f.write("invalid") | ||
| self.assertEqual(pdb.Pdb().rcLines[0], "invalid") | ||
|          | ||
| self.assertEqual(len(pdb.Pdb().rcLines), 1) | ||
|  | ||
| def test_readrc_home_twice(self): | ||
|          | ||
| with os_helper.EnvironmentVarGuard() as env: | ||
| env.unset("HOME") | ||
| with os_helper.temp_cwd() as cwd, patch("os.path.expanduser"): | ||
| rc_path = os.path.join(cwd, ".pdbrc") | ||
| os.path.expanduser.return_value = rc_path | ||
| with open(rc_path, "w") as f: | ||
| f.write("invalid") | ||
| self.assertEqual(pdb.Pdb().rcLines, ["invalid"]) | ||
| self.assertEqual(len(pdb.Pdb().rcLines), 1) | ||
|  | ||
| def test_header(self): | ||
| stdout = StringIO() | ||
| header = 'Nobody expects... blah, blah, blah' | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the equivalent check should be
os.path.abspath(".pdbrc")right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaogaotiantian yeah i don't know what i was thinking there, updated
btw would it be ok to send a separate pr updating the pdb module & its tests to start using pathlib or preferring to keep os.path ?