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