You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it's useful to have the tests that use the network marked so they can be skipped easily when we know the network is not available.
This is useful for example on SUSE and openSUSE's build servers. When building our packages the network is disabled so we can assure reproducible builds (among other benefits). With this mark, it's easier to skip tests that can not succeed.
The %check section of our SPEC file is:
%check# set up working directoryexportBASETEMP=$(mktemp-d-tcachelib_test.XXXXXX)
trap"rm -rf ${BASETEMP}"EXIT# Allow finding memcachedexportPATH="%{_sbindir}/:$PATH"exportPYTEST_ADDOPTS="--capture=tee-sys --tb=short --basetemp=${BASETEMP}"%pytest-rs
(%pytest means basically pytest -v with some variables set to take into consideration building environment).
When running only plain pytest, I get result “11 failed, 117 passed, 1 skipped, 3 errors”.
Obviously the hot candidate are tests using DynamoDB, which is completely inaccessible, so I have created this patch to mark these tests as network-requiring so they can be easily skipped:
Just by applying this patch (and adding -k "not network" to my call of pytest) I get much better results: “117 passed, 1 skipped, 12 deselected, 2 errors”. Again, Complete build log in this situation.
Unfortunately, I don’t know how to skip those remaining two erroring tests. Both of them use so complicated constructs that I don’t know where to put @pytest.mark.skip or @pytest.mark.network and any of my attempts failed to make any difference. The only method which actually works (but I really don’t like it) is --ignore=tests/test_redis_cache.py --ignore=tests/test_memcached_cache.py, which truly make test suite to pass.
Any ideas, how to make the test suite working even without network access? Do I do something wrong in arranging my test environment?
Environment:
Python version: various versions, this particular errors are from “Python 3.8.16”
CacheLib version: 0.10.2 from the tarball from PyPI.
The text was updated successfully, but these errors were encountered:
Sometimes it's useful to have the tests that use the network marked so they can be skipped easily when we know the network is not available.
This is useful for example on SUSE and openSUSE's build servers. When building our packages the network is disabled so we can assure reproducible builds (among other benefits). With this mark, it's easier to skip tests that can not succeed.
The
%check
section of our SPEC file is:(
%pytest
means basicallypytest -v
with some variables set to take into consideration building environment).When running only plain
pytest
, I get result “11 failed, 117 passed, 1 skipped, 3 errors”.Complete build log in this situation
Obviously the hot candidate are tests using DynamoDB, which is completely inaccessible, so I have created this patch to mark these tests as network-requiring so they can be easily skipped:
Just by applying this patch (and adding
-k "not network"
to my call of pytest) I get much better results: “117 passed, 1 skipped, 12 deselected, 2 errors”. Again, Complete build log in this situation.Unfortunately, I don’t know how to skip those remaining two erroring tests. Both of them use so complicated constructs that I don’t know where to put
@pytest.mark.skip
or@pytest.mark.network
and any of my attempts failed to make any difference. The only method which actually works (but I really don’t like it) is--ignore=tests/test_redis_cache.py --ignore=tests/test_memcached_cache.py
, which truly make test suite to pass.Any ideas, how to make the test suite working even without network access? Do I do something wrong in arranging my test environment?
Environment:
The text was updated successfully, but these errors were encountered: