Skip to content

Failed to make tests working with plain pytest #107

@mcepl

Description

@mcepl

While packaging python-redis-lock for openSUSE (version 4.0.0) I have still not been able to make the test suite run. I don’t think we can use plain run of tox, because it starts to pull packages from the Internet (even though we have them already installed), and we don’t have any network connection for the building processes. So, I tried to (with help of some resources on the Internet) run tests like this:

%check
# redis-server is in sbin
export PATH=$PATH:%{_sbindir}
export PYTHONPATH=$(pwd)/tests
export DJANGO_SETTINGS_MODULE=test_project.settings
# gh#ionelmc/python-redis-lock#86
%pytest -k 'not test_no_overlap2'

unfortunately it still fails with

[   12s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-4.0.0/tests/test_project/settings.py", line 14, in <module>
[   12s]     REDIS_SOCKET = os.environ['REDIS_SOCKET']
[   12s]   File "/usr/lib64/python3.9/os.py", line 679, in __getitem__
[   12s]     raise KeyError(key) from None
[   12s] KeyError: 'REDIS_SOCKET'

(complete log of the whole building and testing process

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions