예제 #1
0
 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'])
예제 #2
0
    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')
예제 #3
0
    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"
예제 #4
0
 def test_config(self):
     dispatch('config', ["set", 'token', "123"])
예제 #5
0
 def test_download_error(self, url, error, match):
     with pytest.raises(error, match=match):
         dispatch('download', [url])
예제 #6
0
 def test_unknown_dispatch(self):
     main.dispatch('unknown', [])
예제 #7
0
 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'])