Skip to content

Commit ceda723

Browse files
committed
setup: Add tests --redhat-url option
For testing against an arbitrary redhat bugzilla URL. Useful for doing internal pre-release testing
1 parent b35f555 commit ceda723

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ class TestCommand(Command):
3030
"This will also be very slow."),
3131
("only=", None,
3232
"Run only tests whose name contains the passed string"),
33+
("redhat-url=", None,
34+
"Redhat bugzilla URL to use for ro/rw_functional tests"),
3335
]
3436

3537
def initialize_options(self):
3638
self.ro_functional = False
3739
self.rw_functional = False
3840
self.only = None
41+
self.redhat_url = None
3942

4043
def finalize_options(self):
4144
pass
@@ -76,6 +79,9 @@ def run(self):
7679
except:
7780
print("installHandler hack failed")
7881

82+
import tests as testsmodule
83+
testsmodule.REDHAT_URL = self.redhat_url
84+
7985
tests = unittest.TestLoader().loadTestsFromNames(testfiles)
8086
if self.only:
8187
newtests = []

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def _cleanup_cb():
3131
atexit.register(_cleanup_cb)
3232
bugzillascript = _import("bugzillascript", "bin/bugzilla")
3333

34+
# This is overwritten by python setup.py test --redhat-url, and then
35+
# used in ro/rw tests
36+
REDHAT_URL = None
3437

3538

3639
def diff(orig, new):

tests/ro_functional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class BZFDO(BaseTest):
156156

157157

158158
class RHTest(BaseTest):
159-
url = "https://bugzilla.redhat.com/xmlrpc.cgi"
159+
url = tests.REDHAT_URL or "https://bugzilla.redhat.com/xmlrpc.cgi"
160160
bzclass = bugzilla.RHBugzilla
161161

162162
test0 = BaseTest._testBZClass

tests/rw_functional.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ class RHPartnerTest(BaseTest):
6565
# Despite its name, this instance is simply for bugzilla testing,
6666
# doesn't send out emails and is blown away occasionally. The front
6767
# page has some info.
68-
url = "https://partner-bugzilla.redhat.com/xmlrpc.cgi"
69-
# url = "https://bzweb01-devel.app.eng.rdu.redhat.com/"
68+
url = tests.REDHAT_URL or "https://partner-bugzilla.redhat.com/xmlrpc.cgi"
7069
bzclass = bugzilla.RHBugzilla
7170

7271

0 commit comments

Comments
 (0)