def run_crawl(self, cls, *args, **kwargs): with restore_dict_kv(os.environ, 'DOCIDO_CC_RUNS'), \ docido_config, \ self.crawler(cls, *args, **kwargs), \ self.check_crawl(*args, **kwargs): config_prefix = osp.splitext(__file__)[0] os.environ['DOCIDO_CC_RUNS'] = config_prefix + '-runs.yml' config_settings = config_prefix + '-settings.yml' docido_config.update(Configuration.from_file(config_settings)) for c in dcc_run.run([], environment=Environment()): shutil.rmtree(c['crawl_path'])
def test_backup_key(self): d = {'a': 'b'} with restore_dict_kv(d, 'a'): self.assertEqual(d, {'a': 'b'}) d['a'] = 'c' self.assertEqual(d, {'a': 'b'})
def test_unknown_key(self): d = {'a': 'b'} with restore_dict_kv(d, 'UNKNOWN'): self.assertEqual(d, {'a': 'b'}) d['UNKNOWN'] = 'foo' self.assertTrue('UNKNOWN' not in d)
def test_unknown_key(self): d = {"a": "b"} with restore_dict_kv(d, "UNKNOWN"): self.assertEqual(d, {"a": "b"}) d["UNKNOWN"] = "foo" self.assertTrue("UNKNOWN" not in d)
def test_backup_key(self): d = {"a": "b"} with restore_dict_kv(d, "a"): self.assertEqual(d, {"a": "b"}) d["a"] = "c" self.assertEqual(d, {"a": "b"})