This patch gets rid annoying pytest configuration warnings when running
test/cql-pytest/run. These started to happen after commit
afab1a97c6, due to a pytest bug:
In that commit, we added new "--scylla-path" and "--workdir" parameters
to our pytest tests, and test/cql-pytest/run started passing them,
and test/cql-pytest/run sometest runs pytest as:
pytest --host something --workdir somedir --scylla-path somepath sometest
Pytest wants to find a configuration file (pytest.ini or tox.ini) in the
directory where the tests live, but its logic to find that directory is
buggy: It (_pytest/config/findpaths.py::determine_setup()) looks at
the command line for directory names, and looks for config files in
these directories or any of their parents. It ignores parameters
beginning with "-", but in our case the various arguments like
"--scylla-path" are each followed by another option, and this one is
not ignored! So instead of looking for the config file in sometest's
parent directories (and finding test/cql-pytest/pytest.ini), pytest
sees the directory given after "scylla-path", and finds the completely
irrelevant tox.ini there - and uses that, which (depending what you
have installed) can generate warnings.
The solution is to change the run script to use "--scylla-path=..."
as one parameter instead of "--scylla-path ..." as two parameters.
When it's just one parameter, the pytest determine_setup() logic skips
it entirely, and finds just the actual test directory.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20220309132726.2311721-1-nyh@scylladb.com>
46 lines
1.4 KiB
Python
Executable File
46 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
import run # run.py in this directory
|
|
|
|
print('Scylla is: ' + run.scylla + '.')
|
|
|
|
ssl = '--ssl' in sys.argv
|
|
if ssl:
|
|
cmd = run.run_scylla_ssl_cql_cmd
|
|
check_cql = run.check_ssl_cql
|
|
else:
|
|
cmd = run.run_scylla_cmd
|
|
check_cql = run.check_cql
|
|
|
|
# If the "--raft" option is given, switch to the experimental Raft-based
|
|
# implementation of schema operations. Some tests are expected to fail
|
|
# when not in raft mode, so they use the fails_without_raft fixture
|
|
# that will cause them to xfail when raft isn't used.
|
|
if '--raft' in sys.argv:
|
|
sys.argv.remove('--raft')
|
|
def run_with_raft(pid, dir):
|
|
(c, e) = run_with_raft.orig_cmd(pid, dir)
|
|
return (c + ['--experimental-features=raft'], e)
|
|
run_with_raft.orig_cmd = cmd
|
|
cmd = run_with_raft
|
|
|
|
pid = run.run_with_temporary_dir(cmd)
|
|
ip = run.pid_to_ip(pid)
|
|
wd = run.pid_to_dir(pid)
|
|
|
|
run.wait_for_services(pid, [
|
|
lambda: run.check_rest_api(ip),
|
|
lambda: check_cql(ip)
|
|
])
|
|
success = run.run_pytest(sys.path[0], ['--host=' + ip, '--workdir=' + wd, '--scylla-path=' + run.scylla] + sys.argv[1:])
|
|
|
|
run.summary = 'Scylla tests pass' if success else 'Scylla tests failure'
|
|
|
|
exit(0 if success else 1)
|
|
|
|
# Note that the run.cleanup_all() function runs now, just like on any exit
|
|
# for any reason in this script. It will delete the temporary files and
|
|
# announce the failure or success of the test (printing run.summary).
|