[PATCH 1/1] conftest.py: move common test settings here (from wvpytest.py)

0 views
Skip to first unread message

Rob Browning

unread,
Feb 24, 2026, 5:40:04 PM (2 days ago) Feb 24
to bup-...@googlegroups.com
Move the common BUP_DIR, GIT_DIR, and BUP_TEST_LEVEL settings from
wvpytest.py to conftest.py so that they'll always occur. Some tests
don't actually include wvpytest now (e.g. test_client.py), and so
"./pytest test/int/test_client.py" would fail in the ssh guard
established here

c6d374a5b384ce86b8f7426d53b72b420ff83ae8
ssh: only allow -r - style subprocess trick when testing

because BUP_TEST_LEVEL wasn't set.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---

Pushed to main.

conftest.py | 5 +++++
test/int/test_commit.py | 2 +-
test/lib/wvpytest.py | 8 +-------
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/conftest.py b/conftest.py
index 23a77537..8988c234 100644
--- a/conftest.py
+++ b/conftest.py
@@ -21,8 +21,13 @@ from bup.compat import environ, fsencode
from bup.helpers import finalized


+# Common requirements for all tests
+environ.setdefault(b'BUP_TEST_LEVEL', b'0')
+environ[b'BUP_DIR'] = fsencode(os.devnull)
+environ[b'GIT_DIR'] = fsencode(os.devnull)
_bup_src_top = realpath(dirname(fsencode(__file__)))

+
# The "pwd -P" here may not be appropriate in the long run, but we
# need it until we settle the relevant drecurse/exclusion questions:
# https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0
diff --git a/test/int/test_commit.py b/test/int/test_commit.py
index 25a3ceb0..cd66c642 100644
--- a/test/int/test_commit.py
+++ b/test/int/test_commit.py
@@ -1,7 +1,7 @@

from os import environb as environ
from subprocess import check_call
-import sys
+import os, sys

from wvpytest import *

diff --git a/test/lib/wvpytest.py b/test/lib/wvpytest.py
index 50d4f8d6..3e5f7755 100644
--- a/test/lib/wvpytest.py
+++ b/test/lib/wvpytest.py
@@ -1,12 +1,6 @@
-import os
-import pytest

+import pytest

-# These must be included by all tests. They're here just because this
-# is already sourced "everywhere".
-os.environb.setdefault(b'BUP_TEST_LEVEL', b'0')
-os.environb[b'BUP_DIR'] = b'/dev/null'
-os.environb[b'GIT_DIR'] = b'/dev/null'

def WVPASS(cond = True, fail_value=None):
if fail_value:
--
2.47.3

Reply all
Reply to author
Forward
0 new messages