diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2019-10-02 13:51:17 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2019-10-02 13:51:17 +0100 |
commit | 80d26e1a5be3f32fe04154d6edc0de2744c62994 (patch) | |
tree | 4d7e4bb2d108be11cc4487e5c44376b377430b94 | |
parent | add4a2a054771aa11642c74e13b5e6d3da47a68a (diff) |
cleanup and some refactoring
-rw-r--r-- | datamaps/api/api.py | 1 | ||||
-rw-r--r-- | datamaps/tests/resources/.~lock.master.xlsx# | 1 | ||||
-rw-r--r-- | datamaps/tests/test_cli.py | 19 |
3 files changed, 12 insertions, 9 deletions
diff --git a/datamaps/api/api.py b/datamaps/api/api.py index 549d4fb..6cc6f4e 100644 --- a/datamaps/api/api.py +++ b/datamaps/api/api.py @@ -1,6 +1,7 @@ from ..core import Quarter from ..plugins.dft.master import Master + def project_data_from_master_api(master_file: str, quarter: int, year: int): """Create a Master object directly without the need to explicitly pass a Quarter object. diff --git a/datamaps/tests/resources/.~lock.master.xlsx# b/datamaps/tests/resources/.~lock.master.xlsx# deleted file mode 100644 index 7fb98fe..0000000 --- a/datamaps/tests/resources/.~lock.master.xlsx# +++ /dev/null @@ -1 +0,0 @@ -,lemon,grafter.chutney.lan,27.09.2019 14:05,file:///home/lemon/.config/libreoffice/4;
\ No newline at end of file diff --git a/datamaps/tests/test_cli.py b/datamaps/tests/test_cli.py index 3857626..883f54f 100644 --- a/datamaps/tests/test_cli.py +++ b/datamaps/tests/test_cli.py @@ -2,10 +2,9 @@ import os import shutil from pathlib import Path -import pytest from click.testing import CliRunner -from datamaps.main import cli, _import +from datamaps.main import _import def test_no_expected_sheet_in_batch_import_to_master(mock_config, resource_dir): @@ -19,12 +18,7 @@ def test_no_expected_sheet_in_batch_import_to_master(mock_config, resource_dir): """ runner = CliRunner() mock_config.initialise() - for fl in os.listdir(resource_dir): - if os.path.isfile(os.path.join(resource_dir, fl)): - shutil.copy( - Path.cwd() / "tests" / "resources" / fl, - (Path(mock_config.PLATFORM_DOCS_DIR) / "input"), - ) + _copy_resources_to_input(mock_config, resource_dir) result = runner.invoke(_import, ["templates", "-m"]) assert "Expected Sheet Missing: sheet Introduction in test_template.xlsm is expected from" \ " datamap.csv. Not processing that file until fixed." in result.output @@ -32,3 +26,12 @@ def test_no_expected_sheet_in_batch_import_to_master(mock_config, resource_dir): # assert "Finished." in result.output +def _copy_resources_to_input(mock_config, resource_dir): + for fl in os.listdir(resource_dir): + if os.path.isfile(os.path.join(resource_dir, fl)): + shutil.copy( + Path.cwd() / "tests" / "resources" / fl, + (Path(mock_config.PLATFORM_DOCS_DIR) / "input"), + ) + + |