Modified test suite to collect the error in test_search_as_plugin_ok
This commit is contained in:
parent
12723c9a9d
commit
d5a1df9eb7
|
|
@ -38,7 +38,8 @@ jobs:
|
||||||
python3-coverage erase
|
python3-coverage erase
|
||||||
# Create the caches with macros
|
# Create the caches with macros
|
||||||
python3-coverage run -a src/kibot --help-outputs > /dev/null
|
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 report
|
||||||
python3-coverage html -d output/htmlcov
|
python3-coverage html -d output/htmlcov
|
||||||
coveralls
|
coveralls
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -67,7 +67,7 @@ test_docker_local_1:
|
||||||
# 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 --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
|
$(PY_COV) report
|
||||||
x-www-browser htmlcov/index.html
|
x-www-browser htmlcov/index.html
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ def search_as_plugin(cmd, names):
|
||||||
if os.path.isfile(fname):
|
if os.path.isfile(fname):
|
||||||
logger.debug('Using `{}` for `{}` ({})'.format(fname, cmd, name))
|
logger.debug('Using `{}` for `{}` ({})'.format(fname, cmd, name))
|
||||||
return fname
|
return fname
|
||||||
|
logger.debug(fname+' not found')
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,14 +280,20 @@ def test_unknown_prefix(caplog):
|
||||||
|
|
||||||
|
|
||||||
def test_search_as_plugin_ok(test_dir, 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):
|
with context.cover_it(cov):
|
||||||
detect_kicad()
|
detect_kicad()
|
||||||
load_actions()
|
load_actions()
|
||||||
dir_fake = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data')
|
dir_fake = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data')
|
||||||
GS.kicad_plugins_dirs.append(dir_fake)
|
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'])
|
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"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
|
assert re.search(r"(.*)data/fake_plugin/fake", fname) is not None
|
||||||
|
ctx.clean_up()
|
||||||
|
|
||||||
|
|
||||||
def test_search_as_plugin_fail(test_dir, caplog):
|
def test_search_as_plugin_fail(test_dir, caplog):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue