| @@ -414,7 +414,8 @@ def defaultinit(casf): | |||
| basedir = pathlib.Path.home() / '.casimport' | |||
| basedir.mkdir(exist_ok=True) | |||
| conffile = pathlib.Path(os.environ.get('CASIMPORT_CONF', basedir / 'casimport.conf')) | |||
| conffile = pathlib.Path(os.environ.get('CASIMPORT_CONF', basedir / | |||
| 'casimport.conf')) | |||
| if not conffile.exists(): | |||
| import casimport | |||
| with importlib.resources.path(casimport, | |||
| @@ -539,7 +540,8 @@ class Test(unittest.TestCase): | |||
| fd.write_cache(hellohash, hellodata) | |||
| # that the file exists in the correct place | |||
| self.assertTrue((cachedir / hellohash[0] / (hellohash + '.py')).exists()) | |||
| self.assertTrue((cachedir / hellohash[0] / | |||
| (hellohash + '.py')).exists()) | |||
| # and that when fetched | |||
| data = fd.fetch_data(urlparse('hash://sha256/%s' % hellohash)) | |||
| @@ -638,13 +640,15 @@ class Test(unittest.TestCase): | |||
| # That the default.conf file got copied over. | |||
| filecmp.cmp(defcachedir.parent / | |||
| 'casimport.conf', | |||
| pathlib.Path(__file__).parent / 'default.conf') | |||
| pathlib.Path(__file__).parent / | |||
| 'default.conf') | |||
| # that the cache got created | |||
| self.assertTrue(defcachedir.is_dir()) | |||
| # and that when hello.py is added to the cache | |||
| f._loaders[0].add_file(self.fixtures / 'hello.py') | |||
| f._loaders[0].add_file(self.fixtures / | |||
| 'hello.py') | |||
| # it can be imported | |||
| from cas.v1_f_330884aa2febb5e19fb7194ec6a69ed11dd3d77122f1a5175ee93e73cf0161c3 import hello | |||
| @@ -701,7 +705,8 @@ class Test(unittest.TestCase): | |||
| fdc.add_file(self.fixtures / 'hello.py') | |||
| # and that the aliases are loaded | |||
| with open(self.fixtures / 'randpkg' / 'cas_aliases.txt') as fp: | |||
| with open(self.fixtures / 'randpkg' / | |||
| 'cas_aliases.txt') as fp: | |||
| f.load_aliases(fp.read()) | |||
| # that when we load the alias first | |||
| @@ -777,8 +782,8 @@ class Test(unittest.TestCase): | |||
| try: | |||
| with CASFinder() as f, \ | |||
| tempattrset(sys.modules[__name__], 'load_mod_aliases', | |||
| f.load_mod_aliases): | |||
| tempattrset(sys.modules[__name__], | |||
| 'load_mod_aliases', f.load_mod_aliases): | |||
| f.register(fakeipfsloader) | |||
| @@ -808,7 +813,8 @@ class Test(unittest.TestCase): | |||
| uomock.return_value.__enter__.return_value.status = 200 | |||
| # and returns the correct data | |||
| uomock.return_value.__enter__.return_value.read.return_value = ipfsdata | |||
| uomock.return_value.__enter__.return_value.read. \ | |||
| return_value = ipfsdata | |||
| # that when called | |||
| hashurl = urlparse('ipfs://bafkreibtbcckul7lwxqz7nyzj3dknhwrdxj5o4jc6gsroxxjhzz46albym') | |||
| @@ -846,7 +852,8 @@ class Test(unittest.TestCase): | |||
| uomock.return_value.__enter__.return_value.status = 200 | |||
| # and returns the correct data | |||
| uomock.return_value.__enter__.return_value.read.return_value = httpsdata | |||
| uomock.return_value.__enter__.return_value.read. \ | |||
| return_value = httpsdata | |||
| # that when called | |||
| hashurl = urlparse('https://www.funkthat.com/gitea/jmg/casimport/raw/commit/753e64f53c73d9d1afc4d8a617edb9d3542dcea2/fixtures/hello.py') | |||