Skip to content

Commit 0f3b68e

Browse files
committed
ArgSuite: enter empty directory
1 parent 83b6c85 commit 0f3b68e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

mypy/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(self) -> None:
131131
self.scripts_are_modules = False
132132

133133
# Config file name
134-
self.config_file = 'setup.cfg' # type: Optional[str]
134+
self.config_file = None # type: Optional[str]
135135

136136
# Write junit.xml to given file
137137
self.junit_xml = None # type: Optional[str]

mypy/test/testargs.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88
from mypy.test.helpers import Suite, assert_equal
99
from mypy.options import Options
1010
from mypy.main import process_options
11+
import tempfile
12+
import os
1113

1214

1315
class ArgSuite(Suite):
1416
def test_coherence(self) -> None:
15-
options = Options()
16-
_, parsed_options = process_options([], require_targets=False)
17-
assert_equal(options, parsed_options)
17+
old_cwd = os.getcwd()
18+
with tempfile.TemporaryDirectory(prefix='mypy-test-') as tmpdir:
19+
# Enter directory to avoid finding 'setup.cfg'
20+
os.chdir(tmpdir)
21+
options = Options()
22+
_, parsed_options = process_options([], require_targets=False)
23+
assert_equal(options, parsed_options)
24+
os.chdir(old_cwd)

0 commit comments

Comments
 (0)