FlaPy icon indicating copy to clipboard operation
FlaPy copied to clipboard

Unit Tests partially fail on MacOS

Open FabianScharnboeck opened this issue 2 years ago • 0 comments

MacOS Version: Ventura 13.2.1 Dependencies have been installed via poetry install

Pytest has been invoked twice to see if the same test failes twice.

======================================FAILURES ====================================== __________________________________________ test_tracing ____________________________________________

def test_tracing():
  generic_test_tracing(FlakyAnalyser)

tests/test_run_tests.py:25:


flaky_analyser = <class 'flapy.run_tests.FlakyAnalyser'>

def generic_test_tracing(flaky_analyser: FlakyAnalyser):
    project_name = "test_resources"

    out_dir = Path(os.path.dirname(test_output.__file__)) / "run_tests" / "test_tracing"
    out_dir.mkdir(parents=True, exist_ok=True)
    log_file = out_dir / "execution.log"

    # Clean out_dir
    for path in out_dir.glob("*"):
        if ".gitignore" not in path.name and "__pycache__" not in path.name:
            rm_recursively(path)

    tmp_dir = tempfile_seeded.mkdtemp()
    print(f"Using temporary directory {tmp_dir}")

    # fmt: off
    args = [
        "run_tests.py",
        "--logfile", str(log_file.absolute()),
        "--repository", os.path.dirname(test_resources.__file__),
        "--project-name", project_name,
        "--temp", tmp_dir,
        "--number-test-runs", "1",
        "--tests-to-be-run", "test_trace_me.py",
        "--trace",
            "test_trace_me.py::test_hashing "
            "test_trace_me.py::TestFixtures::test_foo "
            "test_trace_me.py::test_random "
            "test_trace_me.py::test_path "
            "test_trace_me.py::test_super_call",
    ]
    # fmt: on
    analyser = flaky_analyser(args)
    analyser.run()

    results_files = list(Path(tmp_dir).glob("*"))
    print(f"Found following results files: {results_files}")
  assert len(results_files) > 0

E assert 0 > 0 E + where 0 = len([])

tests/test_run_tests.py:69: AssertionError ------------------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------------- Using temporary directory /var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5 Found following results files: [] ------------------------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------------------- INFO: Config: Namespace(logfile='"HERE_MY_PROJECT_PATH"/flapy-github-fork/FlaPy/test_output/run_tests/test_tracing/execution.log', repository='/"HERE_MY_PROJECT_PATH"/flapy-github-fork/FlaPy/test_resources', temp='/var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5', project_name='test_resources', pypi_tag=None, num_runs=1, random_order_bucket=None, random_order_seed=None, trace='test_trace_me.py::test_hashing test_trace_me.py::TestFixtures::test_foo test_trace_me.py::test_random test_trace_me.py::test_path test_trace_me.py::test_super_call', tests_to_be_run='test_trace_me.py') INFO: Iteration 0 of 1 for project test_resources (random=None) INFO: no pypi tag specified -> falling back to searching for requirements INFO: found the following requirements files: ['/var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5/tmpvmpbrhox/requirements.txt'] INFO: executing commands ['echo "which python: $(which python)"', 'echo "which pip: $(which pip)"', 'echo "which pytest: $(which pytest)"', 'echo "python path: "', 'python -c "import sys; print(sys.path)"', 'PYTHONPATH=. pytest_trace "test_trace_me.py::test_hashing test_trace_me.py::TestFixtures::test_foo test_trace_me.py::test_random test_trace_me.py::test_path test_trace_me.py::test_super_call" /var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5/test_resources_trace0test_trace_me.py. -v --rootdir=. --junitxml=/var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5/test_resources_output0test_trace_me.py.xml --cov=. --cov-branch --cov-report xml:/var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5/test_resources_coverage0test_trace_me.py.xml test_trace_me.py '] WARNING: Did not create file /var/folders/wp/hyj7k6ls33g86nz45c7p0hsr0000gn/T/tmpr25wfuh5/test_resources_output0test_trace_me.py.xml while running the tests.

FabianScharnboeck avatar Mar 08 '23 08:03 FabianScharnboeck