Merge pull request #13821 from edx/zoldak/TE-1673
Only install python coverage prereqs for coverage paver tasks TE-1673
This commit is contained in:
@@ -17,6 +17,7 @@ from .utils.timer import timed
|
||||
PREREQS_STATE_DIR = os.getenv('PREREQ_CACHE_DIR', Env.REPO_ROOT / '.prereqs_cache')
|
||||
NPM_REGISTRY = "http://registry.npmjs.org/"
|
||||
NO_PREREQ_MESSAGE = "NO_PREREQ_INSTALL is set, not installing prereqs"
|
||||
COVERAGE_REQ_FILE = 'requirements/edx/coverage.txt'
|
||||
|
||||
# If you make any changes to this list you also need to make
|
||||
# a corresponding change to circle.yml, which is how the python
|
||||
@@ -142,7 +143,13 @@ def python_prereqs_installation():
|
||||
Installs Python prerequisites
|
||||
"""
|
||||
for req_file in PYTHON_REQ_FILES:
|
||||
sh("pip install -q --disable-pip-version-check --exists-action w -r {req_file}".format(req_file=req_file))
|
||||
pip_install_req_file(req_file)
|
||||
|
||||
|
||||
def pip_install_req_file(req_file):
|
||||
"""Pip install the requirements file."""
|
||||
pip_cmd = 'pip install -q --disable-pip-version-check --exists-action w'
|
||||
sh("{pip_cmd} -r {req_file}".format(pip_cmd=pip_cmd, req_file=req_file))
|
||||
|
||||
|
||||
@task
|
||||
@@ -237,6 +244,16 @@ def package_in_frozen(package_name, frozen_output):
|
||||
return bool(re.search(pattern, frozen_output))
|
||||
|
||||
|
||||
@task
|
||||
@timed
|
||||
def install_coverage_prereqs():
|
||||
""" Install python prereqs for measuring coverage. """
|
||||
if no_prereq_install():
|
||||
print NO_PREREQ_MESSAGE
|
||||
return
|
||||
pip_install_req_file(COVERAGE_REQ_FILE)
|
||||
|
||||
|
||||
@task
|
||||
@timed
|
||||
def install_python_prereqs():
|
||||
|
||||
@@ -245,7 +245,7 @@ def test(options, passthrough_options):
|
||||
|
||||
|
||||
@task
|
||||
@needs('pavelib.prereqs.install_prereqs')
|
||||
@needs('pavelib.prereqs.install_coverage_prereqs')
|
||||
@cmdopts([
|
||||
("compare-branch=", "b", "Branch to compare against, defaults to origin/master"),
|
||||
("compare_branch=", None, "deprecated in favor of compare-branch"),
|
||||
@@ -283,7 +283,7 @@ def coverage():
|
||||
|
||||
|
||||
@task
|
||||
@needs('pavelib.prereqs.install_prereqs')
|
||||
@needs('pavelib.prereqs.install_coverage_prereqs')
|
||||
@cmdopts([
|
||||
("compare-branch=", "b", "Branch to compare against, defaults to origin/master"),
|
||||
("compare_branch=", None, "deprecated in favor of compare-branch"),
|
||||
|
||||
@@ -146,9 +146,7 @@ sqlparse>=0.2.0,<0.3.0
|
||||
before_after==0.1.3
|
||||
bok-choy==0.5.3
|
||||
chrono==1.0.2
|
||||
coverage==4.2
|
||||
ddt==0.8.0
|
||||
diff-cover==0.9.8
|
||||
django-crum==0.5
|
||||
django_nose==1.4.1
|
||||
factory_boy==2.5.1
|
||||
@@ -193,3 +191,6 @@ edx-django-release-util==0.1.2
|
||||
# Used to communicate with Neo4j, which is used internally for
|
||||
# modulestore inspection
|
||||
py2neo==3.1.2
|
||||
|
||||
# for calculating coverage
|
||||
-r coverage.txt
|
||||
|
||||
7
requirements/edx/coverage.txt
Normal file
7
requirements/edx/coverage.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Dependencies that are used solely for calculating test coverage.
|
||||
# These are split out so that if you are only calculating coverage
|
||||
# then you don't need to install all the rest of the prereqs.
|
||||
#
|
||||
coverage==4.2
|
||||
diff-cover==0.9.8
|
||||
Reference in New Issue
Block a user