testing: add vcttesting to virtualenv
The support modules in the vcttesting package are becoming increasingly
popular. This directory currently must be manually added to sys.path.
This is annoying.
This patch adds packaging to vcttesting so it is available in our
virtualenv.
Scripts manually adding the testing directory to sys.path have been
updated to no longer do this.
--- a/.hgignore
+++ b/.hgignore
@@ -3,16 +3,17 @@ docs/_build/
hghooks/Mozilla_Hg_Hooks.egg-info/
pylib/mozreview/mozreview.egg-info/
pylib/rbbz/rbbz.egg-info/
pylib/rbmozui/rbmozui.egg-info/
pylib/Bugsy/bugsy.egg-info/
testing/bmoserver/.vagrant
testing/puppet/files/Mozilla-Bugzilla-Public*
testing/unifiedserver/.vagrant
+testing/vcttesting.egg-info/
venv/
\.pyc$
\.pyo$
\.swp$
\.t.err$
~$
\.vagrant/*
\.docker-state.json$
--- a/bugzilla
+++ b/bugzilla
@@ -4,21 +4,18 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This is a script for performing common Bugzilla operations from the command
# line. It is meant to support testing.
import os
import sys
-HERE = os.path.abspath(os.path.dirname(__file__))
def main(args):
- sys.path.insert(0, os.path.join(HERE, 'testing'))
-
from mach.main import Mach
m = Mach(os.getcwd())
m.define_category('bugzilla', 'Bugzilla',
'Interface with Bugzilla', 50)
import vcttesting.bugzilla.mach_commands
return m.run(args)
--- a/create-test-environment
+++ b/create-test-environment
@@ -30,16 +30,20 @@ cd ../..
cd pylib/rbbz
python setup.py develop
cd ../..
cd hghooks
python setup.py develop
cd ..
+cd testing
+python setup.py develop
+cd ..
+
# Collect code coverage from all Python processes if environment variable
# is set.
cat > venv/bin/sitecustomize.py << EOF
import os
if os.environ.get('CODE_COVERAGE', False):
import uuid
import coverage
--- a/mozreview
+++ b/mozreview
@@ -9,18 +9,16 @@ import sys
HERE = os.path.abspath(os.path.dirname(__file__))
def main(args):
if 'VIRTUAL_ENV' not in os.environ:
activate = os.path.join(HERE, 'venv', 'bin', 'activate_this.py')
execfile(activate, dict(__file__=activate))
sys.executable = os.path.join(HERE, 'venv', 'bin', 'python')
- sys.path.insert(0, os.path.join(HERE, 'testing'))
-
from mach.main import Mach
m = Mach(os.getcwd())
m.define_category('mozreview', 'MozReview',
'Control and Interact with the Mozilla Code Review Service', 50)
import vcttesting.mozreview_mach_commands
--- a/pulse
+++ b/pulse
@@ -9,18 +9,16 @@ import sys
HERE = os.path.abspath(os.path.dirname(__file__))
def main(args):
if 'VIRTUAL_ENV' not in os.environ:
activate = os.path.join(HERE, 'venv', 'bin', 'activate_this.py')
execfile(activate, dict(__file__=activate))
sys.executable = os.path.join(HERE, 'venv', 'bin', 'python')
- sys.path.insert(0, os.path.join(HERE, 'testing'))
-
from mach.main import Mach
m = Mach(os.getcwd())
m.define_category('pulse', 'Pulse',
'Control and Interact with the Pulse Message Broker', 50)
import vcttesting.pulse_mach_commands
--- a/reviewboard
+++ b/reviewboard
@@ -1,21 +1,18 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
-HERE = os.path.abspath(os.path.dirname(__file__))
def main(args):
- sys.path.insert(0, os.path.join(HERE, 'testing'))
-
from mach.main import Mach
m = Mach(os.getcwd())
m.define_category('reviewboard', 'Review Board',
'Interface with Review Board', 50)
import vcttesting.reviewboard.mach_commands
return m.run(args)
--- a/run-mercurial-tests.py
+++ b/run-mercurial-tests.py
@@ -19,17 +19,16 @@ import time
# anyway.
HERE = os.path.dirname(os.path.abspath(__file__))
RUNTESTS = os.path.join(HERE, 'pylib', 'mercurial-support', 'run-tests.py')
EXTDIR = os.path.join(HERE, 'hgext')
sys.path.insert(0, os.path.join(HERE, 'pylib', 'mercurial-support'))
runtestsmod = imp.load_source('runtests', RUNTESTS)
-sys.path.insert(0, os.path.join(HERE, 'testing'))
def is_test_filename(f):
return f.startswith('test-') and f.endswith(('.py', '.t'))
def get_extensions():
"""Obtain information about extensions.
Returns a dict mapping extension name to metadata.
new file mode 100644
--- /dev/null
+++ b/testing/setup.py
@@ -0,0 +1,13 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from setuptools import setup
+
+setup(
+ name='vcttesting',
+ version='0.0.1',
+ description='Support code to support testing the version-control-tools repo',
+ license='MPL',
+ packages=['vcttesting'],
+)