diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 8d3b4dd152d..8e662ed1564 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -26,6 +26,8 @@ from samba.samdb import SamDB import subprocess import tempfile +samba.ensure_external_module("mimeparse", "mimeparse") +samba.ensure_external_module("extras", "extras") samba.ensure_external_module("testtools", "testtools") # Other modules import these two classes from here, for convenience: diff --git a/python/samba/tests/subunitrun.py b/python/samba/tests/subunitrun.py index d45467607e6..291e7ab461a 100755 --- a/python/samba/tests/subunitrun.py +++ b/python/samba/tests/subunitrun.py @@ -37,9 +37,7 @@ signal.signal(signal.SIGINT, signal.SIG_DFL) import optparse import samba import sys -samba.ensure_external_module("mimeparse", "mimeparse") -samba.ensure_external_module("extras", "extras") -samba.ensure_external_module("testtools", "testtools") +import samba.tests samba.ensure_external_module("subunit", "subunit/python") import subunit.run diff --git a/selftest/filter-subunit b/selftest/filter-subunit index 2ce9584c2a5..4f95546794a 100755 --- a/selftest/filter-subunit +++ b/selftest/filter-subunit @@ -19,14 +19,15 @@ # to upstream subunit's filtering tools. import optparse -import os import sys import signal -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/subunit/python")) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/testtools")) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/mimeparse")) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/extras")) +sys.path.insert(0, "bin/python") +import samba +samba.ensure_external_module("mimeparse", "mimeparse") +samba.ensure_external_module("extras", "extras") +samba.ensure_external_module("testtools", "testtools") +samba.ensure_external_module("subunit", "subunit/python") import subunithelper diff --git a/selftest/format-subunit b/selftest/format-subunit index f59de972584..58321bf368a 100755 --- a/selftest/format-subunit +++ b/selftest/format-subunit @@ -9,10 +9,12 @@ import os import signal import sys -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/subunit/python")) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/testtools")) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/mimeparse")) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/extras")) +sys.path.insert(0, "bin/python") +import samba +samba.ensure_external_module("mimeparse", "mimeparse") +samba.ensure_external_module("extras", "extras") +samba.ensure_external_module("testtools", "testtools") +samba.ensure_external_module("subunit", "subunit/python") import subunithelper diff --git a/source4/dsdb/tests/python/dsdb_schema_info.py b/source4/dsdb/tests/python/dsdb_schema_info.py index 28fce1b00f4..8f64f1063c0 100755 --- a/source4/dsdb/tests/python/dsdb_schema_info.py +++ b/source4/dsdb/tests/python/dsdb_schema_info.py @@ -30,8 +30,7 @@ import time import random sys.path.insert(0, "bin/python") -import samba -samba.ensure_external_module("testtools", "testtools") +import samba.tests from ldb import SCOPE_BASE, LdbError diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py index f692edc4f57..683987fdb6d 100644 --- a/source4/torture/drs/python/drs_base.py +++ b/source4/torture/drs/python/drs_base.py @@ -24,10 +24,8 @@ import time import os sys.path.insert(0, "bin/python") -import samba +import samba.tests from samba import dsdb -samba.ensure_external_module("testtools", "testtools") -samba.ensure_external_module("subunit", "subunit/python") from ldb import ( SCOPE_BASE, @@ -35,8 +33,6 @@ from ldb import ( FLAG_MOD_REPLACE, ) -import samba.tests - class DrsBaseTestCase(samba.tests.BlackboxTestCase): """Base class implementation for all DRS python tests.