From d5a1df9eb79fe9a5ec48bac5d15948c66cbc947f Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 12 Feb 2021 13:10:22 -0300 Subject: [PATCH] Modified test suite to collect the error in test_search_as_plugin_ok --- .github/workflows/pythonapp.yml | 3 ++- Makefile | 2 +- kibot/kiplot.py | 1 + tests/test_plot/test_misc_2.py | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index d31d4aae..ffffc4bc 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -38,7 +38,8 @@ jobs: python3-coverage erase # Create the caches with macros python3-coverage run -a src/kibot --help-outputs > /dev/null - pytest-3 --test_dir output + #pytest-3 --test_dir output + pytest-3 --log-cli-level debug -k "test_search_as_plugin_ok" --test_dir output python3-coverage report python3-coverage html -d output/htmlcov coveralls diff --git a/Makefile b/Makefile index 83058468..b76406c3 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ test_docker_local_1: # 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 --log-cli-level debug -k 'test_import_no_fail' --test_dir output ; $(PY_COV) html; chown -R $(USER_ID):$(GROUP_ID) output/ tests/board_samples/ .coverage htmlcov/" + /bin/bash -c "flake8 . --count --statistics ; python3-coverage run -a src/kibot --help-outputs > /dev/null; pytest-3 --log-cli-level debug -k 'test_search_as_plugin_ok' --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/kibot/kiplot.py b/kibot/kiplot.py index daccc447..8c8647f4 100644 --- a/kibot/kiplot.py +++ b/kibot/kiplot.py @@ -128,6 +128,7 @@ def search_as_plugin(cmd, names): if os.path.isfile(fname): logger.debug('Using `{}` for `{}` ({})'.format(fname, cmd, name)) return fname + logger.debug(fname+' not found') return cmd diff --git a/tests/test_plot/test_misc_2.py b/tests/test_plot/test_misc_2.py index 4e6e4830..6fbe7503 100644 --- a/tests/test_plot/test_misc_2.py +++ b/tests/test_plot/test_misc_2.py @@ -280,14 +280,20 @@ def test_unknown_prefix(caplog): def test_search_as_plugin_ok(test_dir, caplog): + ctx = context.TestContext(test_dir, 'test_search_as_plugin_ok', 'test_v5', 'empty_zip', '') with context.cover_it(cov): detect_kicad() load_actions() dir_fake = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data') GS.kicad_plugins_dirs.append(dir_fake) + logging.debug('GS.kicad_plugins_dirs: '+str(GS.kicad_plugins_dirs)) fname = search_as_plugin('fake', ['fake_plugin']) + logging.debug('fname: '+fname) + with open(ctx.get_out_path('error.txt'), 'wt') as f: + f.write(caplog.text) assert re.search(r"Using `(.*)data/fake_plugin/fake` for `fake` \(fake_plugin\)", caplog.text) is not None assert re.search(r"(.*)data/fake_plugin/fake", fname) is not None + ctx.clean_up() def test_search_as_plugin_fail(test_dir, caplog):