From b53ffbb032120906f2b3ca8ec3f5423ea5e967ec Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 29 Jan 2021 15:27:52 -0300 Subject: [PATCH] Added Python cache creation before running the tests. It looks like pytest is loading some modules without macros. The cache gets created without them. But when we load the same modules with macros it fails. --- .github/workflows/pythonapp.yml | 1 + Makefile | 2 +- tests/test_plot/test_misc_2.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 2f7690b5..ccecef43 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -35,6 +35,7 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} run: | + src/kibot --help-outputs python3-coverage erase pytest-3 --test_dir output python3-coverage report diff --git a/Makefile b/Makefile index 30a2ff61..5460d589 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ test_docker_local: # Run in the same directory to make the __pycache__ valid # Also change the owner of the files to the current user (we run as root like in GitHub) docker run --rm -v $(CWD):$(CWD) --workdir="$(CWD)" setsoft/kicad_auto_test:latest \ - /bin/bash -c "flake8 . --count --statistics ; pytest-3 --test_dir output ; $(PY_COV) html; chown -R $(USER_ID):$(GROUP_ID) output/ tests/board_samples/ .coverage htmlcov/" + /bin/bash -c "flake8 . --count --statistics ; src/kibot --help-outputs ; pytest-3 --test_dir output ; $(PY_COV) html; chown -R $(USER_ID):$(GROUP_ID) output/ tests/board_samples/ .coverage htmlcov/" $(PY_COV) report x-www-browser htmlcov/index.html diff --git a/tests/test_plot/test_misc_2.py b/tests/test_plot/test_misc_2.py index 7019cbe9..9e400f9d 100644 --- a/tests/test_plot/test_misc_2.py +++ b/tests/test_plot/test_misc_2.py @@ -23,6 +23,7 @@ from kibot.misc import (MISSING_TOOL, WRONG_INSTALL) cov = coverage.Coverage() mocked_check_output_FNF = True + # Important note: # - We can't load the plug-ins twice, the import fails. # - Once we patched them using monkey patch the patch isn't reverted unless we load them again.