From e5e7780f32d20a328c8981ae80e2f080323482c4 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 11 Oct 2022 21:48:25 +0300 Subject: [PATCH] test: work around modern pytest rejecting site-packages Modern (as of Fedora 37) pytest has the "-sP" flags in the Python command line, as found in /usr/bin/pytest. This means it will reject the site-packages directory, where we install the Scylla Python driver. This causes all the tests to fail. Work around it by supplying an alternative pytest script that does not have this change. Closes #11764 --- test.py | 4 ++-- test/pytest | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100755 test/pytest diff --git a/test.py b/test.py index 2022054735..4b725b1b2c 100755 --- a/test.py +++ b/test.py @@ -613,7 +613,7 @@ class CQLApprovalTest(Test): def __init__(self, test_no: int, shortname: str, suite) -> None: super().__init__(test_no, shortname, suite) # Path to cql_repl driver, in the given build mode - self.path = "pytest" + self.path = "./test/pytest" self.cql = suite.suite_path / (self.shortname + ".cql") self.result = suite.suite_path / (self.shortname + ".result") self.tmpfile = os.path.join(suite.options.tmpdir, self.mode, self.uname + ".reject") @@ -769,7 +769,7 @@ class PythonTest(Test): def __init__(self, test_no: int, shortname: str, suite) -> None: super().__init__(test_no, shortname, suite) - self.path = "pytest" + self.path = "./test/pytest" self.xmlout = os.path.join(self.suite.options.tmpdir, self.mode, "xml", self.uname + ".xunit.xml") self.server_log: Optional[str] = None self.server_log_filename: Optional[pathlib.Path] = None diff --git a/test/pytest b/test/pytest new file mode 100755 index 0000000000..f478e06899 --- /dev/null +++ b/test/pytest @@ -0,0 +1,7 @@ +#!/bin/sh -e + +# Modern pytest excludes site-packages, so it doesn't see scylla-driver. +# This script is a workaround. + +exec python -m pytest "$@" +