Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.tempdir = utils.Tempdir()
self.tempdir.setup()
for f in FILES:
self.tempdir.create_file(f, FILES[f])
self.fs = fs.OSFileSystem(self.tempdir.path)
def testResolveSystemRelative(self):
with utils.Tempdir() as d:
os_fs = fs.OSFileSystem(d.path)
fspath = [os_fs]
d.create_file("foo/x.py")
d.create_file("foo/y.py")
imp = parsepy.ImportStatement(".y")
module = resolve.System(d["foo/x.py"], "foo.x")
r = resolve.Resolver(fspath, module)
f = r.resolve_import(imp)
self.assertEqual(f.path, d["foo/y.py"])
self.assertTrue(isinstance(f, resolve.System))
self.assertEqual(f.module_name, "foo.y")
def setUp(self):
self.tempdir = utils.Tempdir()
self.tempdir.setup()
for f in FILES:
self.tempdir.create_file(f, FILES[f])
self.fs = LowercasingFileSystem(
fs.OSFileSystem(self.tempdir.path))
def add_path(self, path, kind='os'):
if kind == 'os':
path = OSFileSystem(path)
elif kind == 'pyi':
path = PYIFileSystem(OSFileSystem(path))
else:
raise FileSystemError('Unrecognized filesystem type: ', kind)
self.paths.append(path)