From ed9919341bb354efc4ae415e6766fea188fb8749 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Mon, 10 Jul 2023 19:02:01 -0400 Subject: [PATCH 1/2] import directly from wxflow in tests --- setup.cfg | 2 +- tests/test_configuration.py | 2 +- tests/test_exceptions.py | 2 +- tests/test_executable.py | 2 +- tests/test_factory.py | 2 +- tests/test_file_utils.py | 2 +- tests/test_jinja.py | 3 +-- tests/test_logger.py | 2 +- tests/test_schema.py | 7 ++----- tests/test_template.py | 2 +- tests/test_timetools.py | 2 +- tests/test_yaml_file.py | 4 ++-- 12 files changed, 14 insertions(+), 18 deletions(-) diff --git a/setup.cfg b/setup.cfg index a59b431..0661490 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ where=src [options.extras_require] dev = pytest>=7; pytest-cov>=3; isort>=5; pycodestyle>=2; pre-commit>=2; tox>=3 -docs = sphinx>=4; sphinx-autobuild; sphinx_td_theme>=0.5; furo>=2023.03.23; sphinx-copybutton +docs = sphinx>=4; sphinx-autobuild; sphinx_rtd_theme>=0.5; furo>=2023.03.23; sphinx-copybutton [green] file-pattern = test_*.py diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 7926f09..80ed966 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -3,7 +3,7 @@ import pytest -from wxflow.configuration import Configuration, cast_as_dtype +from wxflow import Configuration, cast_as_dtype file0 = """#!/bin/bash export SOME_ENVVAR1="${USER}" diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 6352a5f..c173a60 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -1,6 +1,6 @@ import pytest -from wxflow.exceptions import WorkflowException +from wxflow import WorkflowException # ---- diff --git a/tests/test_executable.py b/tests/test_executable.py index 2f19587..d137114 100644 --- a/tests/test_executable.py +++ b/tests/test_executable.py @@ -3,7 +3,7 @@ import pytest -from wxflow.executable import CommandNotFoundError, Executable, which +from wxflow import CommandNotFoundError, Executable, which script = """#!/bin/bash echo ${USER} diff --git a/tests/test_factory.py b/tests/test_factory.py index b533fe1..d3d0275 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -1,4 +1,4 @@ -from wxflow.factory import Factory +from wxflow import Factory class Class1: diff --git a/tests/test_file_utils.py b/tests/test_file_utils.py index 08b305e..3710881 100644 --- a/tests/test_file_utils.py +++ b/tests/test_file_utils.py @@ -1,6 +1,6 @@ import os -from wxflow.file_utils import FileHandler +from wxflow import FileHandler def test_mkdir(tmp_path): diff --git a/tests/test_jinja.py b/tests/test_jinja.py index bfc23f3..35dd6ca 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -2,8 +2,7 @@ import pytest -from wxflow.jinja import Jinja -from wxflow.timetools import to_isotime +from wxflow import Jinja, to_isotime current_date = datetime.now() j2tmpl = """Hello {{ name }}! {{ greeting }} It is: {{ current_date | to_isotime }}""" diff --git a/tests/test_logger.py b/tests/test_logger.py index d231e65..f67ad6b 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -1,4 +1,4 @@ -from wxflow.logger import Logger, logit +from wxflow import Logger, logit level = 'debug' number_of_log_msgs = 5 diff --git a/tests/test_schema.py b/tests/test_schema.py index ab74034..78712f7 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -9,10 +9,7 @@ import pytest -from wxflow import schema -from wxflow.configuration import cast_strdict_as_dtypedict -from wxflow.schema import SchemaError -from wxflow.yaml_file import parse_yaml +from wxflow import schema, parse_yaml, cast_strdict_as_dtypedict # Define the path to the YAML-formatted file containing the schema @@ -71,7 +68,7 @@ def test_validate_schema(): try: data_out = schema.validate_schema( schema_dict=schema_dict, data=data_in) - except SchemaError: + except schema.SchemaError: assert True # This unit-test passes the full environment, including `data_in`, diff --git a/tests/test_template.py b/tests/test_template.py index 8e3c795..48f60f0 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -1,6 +1,6 @@ import os -from wxflow.template import Template, TemplateConstants +from wxflow import Template, TemplateConstants def test_substitute_string_from_dict(): diff --git a/tests/test_timetools.py b/tests/test_timetools.py index d114a19..0489748 100644 --- a/tests/test_timetools.py +++ b/tests/test_timetools.py @@ -1,6 +1,6 @@ from datetime import datetime, timedelta -from wxflow.timetools import * +from wxflow import * current_date = datetime.now() diff --git a/tests/test_yaml_file.py b/tests/test_yaml_file.py index 83350c4..81b8131 100644 --- a/tests/test_yaml_file.py +++ b/tests/test_yaml_file.py @@ -3,8 +3,8 @@ import pytest -from wxflow.yaml_file import (YAMLFile, dump_as_yaml, parse_j2yaml, - parse_yamltmpl, save_as_yaml) +from wxflow import (YAMLFile, dump_as_yaml, parse_j2yaml, + parse_yamltmpl, save_as_yaml) host_yaml = """ host: From fa83df67fae922be93cbb4fd5f2483af9691e9dc Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Mon, 10 Jul 2023 19:04:49 -0400 Subject: [PATCH 2/2] fix pynorms --- tests/test_schema.py | 2 +- tests/test_yaml_file.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_schema.py b/tests/test_schema.py index 78712f7..da280d9 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -9,7 +9,7 @@ import pytest -from wxflow import schema, parse_yaml, cast_strdict_as_dtypedict +from wxflow import cast_strdict_as_dtypedict, parse_yaml, schema # Define the path to the YAML-formatted file containing the schema diff --git a/tests/test_yaml_file.py b/tests/test_yaml_file.py index 81b8131..9e5b5e2 100644 --- a/tests/test_yaml_file.py +++ b/tests/test_yaml_file.py @@ -3,8 +3,8 @@ import pytest -from wxflow import (YAMLFile, dump_as_yaml, parse_j2yaml, - parse_yamltmpl, save_as_yaml) +from wxflow import (YAMLFile, dump_as_yaml, parse_j2yaml, parse_yamltmpl, + save_as_yaml) host_yaml = """ host: