Modified test suite to collect the error in test_search_as_plugin_ok

This commit is contained in:
Salvador E. Tropea 2021-02-12 13:10:22 -03:00
parent 12723c9a9d
commit d5a1df9eb7
4 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):