def test_download(self): # with pytest.raises(FileNotFoundError) as excinfo: # report.dispatch('download', \ # ['--zip_url', 'https://github.com/thu-coai/cotk-test-CVAE/archive/no_output.zip']) # assert "New result file not found." == str(excinfo.value) dispatch( 'download', ['https://github.com/thu-coai/cotk-test-CVAE/tree/run_and_test'])
def test_import_local_resources(self): shutil.copyfile('./tests/_utils/dummy_coai/test.json', './cotk/resource_config/test.json') dispatch('import', ['resources://test', './tests/_utils/data/test.zip']) os.remove('./cotk/resource_config/test.json')
def test_config(self): assert config.config_load("test_variable") is None main.dispatch('config', ["set", 'test_variable', "123"]) main.dispatch('config', ["show", 'test_variable']) assert config.config_load("test_variable") == "123" main.dispatch('config', ["set", 'test_variable', "123", "456"]) main.dispatch('config', ["show", 'test_variable']) assert config.config_load("test_variable") == "123 456"
def test_config(self): dispatch('config', ["set", 'token', "123"])
def test_download_error(self, url, error, match): with pytest.raises(error, match=match): dispatch('download', [url])
def test_unknown_dispatch(self): main.dispatch('unknown', [])
def test_import_local_resources(self): shutil.copyfile('./tests/file_utils/dummy_coai/test.json', CONFIG_DIR + '/test.json') main.dispatch('import', ['resources://test', './tests/file_utils/data/test.zip'])