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.
This commit is contained in:
Salvador E. Tropea 2021-01-29 15:27:52 -03:00
parent d796abde2e
commit b53ffbb032
3 changed files with 3 additions and 1 deletions

View File

@ -35,6 +35,7 @@ jobs:
env: env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: | run: |
src/kibot --help-outputs
python3-coverage erase python3-coverage erase
pytest-3 --test_dir output pytest-3 --test_dir output
python3-coverage report python3-coverage report

View File

@ -77,7 +77,7 @@ test_docker_local:
# Run in the same directory to make the __pycache__ valid # 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) # 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 \ 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 $(PY_COV) report
x-www-browser htmlcov/index.html x-www-browser htmlcov/index.html

View File

@ -23,6 +23,7 @@ from kibot.misc import (MISSING_TOOL, WRONG_INSTALL)
cov = coverage.Coverage() cov = coverage.Coverage()
mocked_check_output_FNF = True mocked_check_output_FNF = True
# Important note: # Important note:
# - We can't load the plug-ins twice, the import fails. # - 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. # - Once we patched them using monkey patch the patch isn't reverted unless we load them again.