diff --git a/justfile b/justfile index cc48eb7..9c245b5 100644 --- a/justfile +++ b/justfile @@ -17,7 +17,7 @@ test +projects=PROJECTS: for p in "{{projects}}".split(): run(f"poetry -C {p}/ install") - run(f"poetry -C {p}/ run nox -f {p}/noxfile.py -s integration-tests") + run(f"poetry -C {p}/ run nox -f {p}/noxfile.py -s my-integration-tests") # run(f"poetry -C {p}/ run pytest -s {p}/test") sys.exit(rc) diff --git a/pytest-extension/noxfile.py b/pytest-extension/noxfile.py index bed354a..e013843 100644 --- a/pytest-extension/noxfile.py +++ b/pytest-extension/noxfile.py @@ -2,6 +2,8 @@ import sys import nox +from nox import Session +from noxconfig import PROJECT_CONFIG print(sys.path) # imports all nox task provided by the toolbox @@ -9,3 +11,12 @@ # default actions to be run if nothing is explicitly specified with the -s option nox.options.sessions = ["fix"] + + +@nox.session(name="my-integration-tests", python=False) +def my_integration_tests(session: Session) -> None: + path = PROJECT_CONFIG.root / "test" / "integration" + base_command = ["poetry", "run"] + pytest_command = ["pytest", "-v", "-s", f"{path}"] + command = base_command + pytest_command + session.run(*command) diff --git a/pytest-extension/test/integration/pytest_extension_test.py b/pytest-extension/test/integration/pytest_extension_test.py index 3b7f7aa..9b3ebfe 100644 --- a/pytest-extension/test/integration/pytest_extension_test.py +++ b/pytest-extension/test/integration/pytest_extension_test.py @@ -72,17 +72,14 @@ def validate_database_std_params(**kwargs): assert res def validate_bucketfs_std_params(**kwargs): - try: - # Temporary work around for the bug in PEC (Issue#78 - no default for the path_in_bucket - if StdParams.path_in_bucket.name in kwargs and kwargs[StdParams.path_in_bucket.name] is None: - kwargs[StdParams.path_in_bucket.name] = '' - bfs_path = create_bucketfs_location(**kwargs) - bfs_path = bfs_path / 'test_file.txt' - bfs_path.write(TEST_FILE_CONTENT) - file_content = b"".join(bfs_path.read()) - assert file_content == TEST_FILE_CONTENT - except Exception as ex: - pass + # Temporary work around for the bug in PEC (Issue#78 - no default for the path_in_bucket + if StdParams.path_in_bucket.name in kwargs and kwargs[StdParams.path_in_bucket.name] is None: + kwargs[StdParams.path_in_bucket.name] = '' + bfs_path = create_bucketfs_location(**kwargs) + bfs_path = bfs_path / 'test_file.txt' + bfs_path.write(TEST_FILE_CONTENT) + file_content = b"".join(bfs_path.read()) + assert file_content == TEST_FILE_CONTENT def validate_cli_args(backend, cli_args, base_tag, callback): if backend == BACKEND_ONPREM: @@ -94,7 +91,7 @@ def validate_cli_args(backend, cli_args, base_tag, callback): opts = select_std_options(tags) cmd = click.Command('whatever', params=opts, callback=callback) runner = CliRunner() - runner.invoke(cmd, args=cli_args, catch_exceptions=False, standalone_mode=True) + runner.invoke(cmd, args=cli_args, catch_exceptions=False, standalone_mode=False) def test_database_std_params(database_std_params): validate_database_std_params(**database_std_params)