-
Notifications
You must be signed in to change notification settings - Fork 170
skip directories with perm error when building autoimport index #733
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
Changes from 1 commit
cba8071
bc6a0c3
5ce1201
82d498e
a3b64ae
37252b6
c14b273
351408c
44236e3
c946a9c
0e229d2
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 |
---|---|---|
|
@@ -142,6 +142,22 @@ def test_generate_full_cache(self): | |
for table in self.importer._dump_all(): | ||
self.assertTrue(len(table) > 0) | ||
|
||
def test_generate_full_cache(self): | ||
"""The single thread test takes much longer than the multithread test but is easier to debug""" | ||
single_thread = False | ||
self.importer.generate_modules_cache(single_thread=single_thread) | ||
""" | ||
Create a temporary directory and set permissions to 000 | ||
""" | ||
lieryan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import tempfile, sys | ||
with tempfile.TemporaryDirectory() as dir: | ||
import os | ||
os.chmod(dir, 0) | ||
sys.path.append(dir) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test lacks isolation, changing the sys.path here is global mutation that won't be undone by the end of the test so it will affect other tests as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MrBago I think it's enough to remove the dir at the end of the context manager. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lieryan I updated the test to use |
||
self.importer.generate_modules_cache(single_thread=single_thread) | ||
MrBago marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.assertIn(("from typing import Dict", "Dict"), self.importer.search("Dict")) | ||
self.assertTrue(len(self.importer._dump_all()) > 0) | ||
|
||
|
||
class AutoImportObservingTest(unittest.TestCase): | ||
def setUp(self): | ||
|
Uh oh!
There was an error while loading. Please reload this page.