Merge pull request #16401 from edx/estute/disable-capturing-stderr-in-pytest-output
add option to disable capturing stderr in pytest
This commit is contained in:
@@ -49,6 +49,10 @@ __test__ = False # do not collect
|
|||||||
make_option("--verbose", action="store_const", const=2, dest="verbosity"),
|
make_option("--verbose", action="store_const", const=2, dest="verbosity"),
|
||||||
make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"),
|
make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"),
|
||||||
make_option("-v", "--verbosity", action="count", dest="verbosity", default=1),
|
make_option("-v", "--verbosity", action="count", dest="verbosity", default=1),
|
||||||
|
make_option(
|
||||||
|
"--disable_capture", action="store_true", dest="disable_capture",
|
||||||
|
help="Disable capturing of stdout/stderr"
|
||||||
|
),
|
||||||
make_option(
|
make_option(
|
||||||
'--disable-migrations',
|
'--disable-migrations',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
@@ -132,6 +136,10 @@ def test_system(options, passthrough_options):
|
|||||||
make_option("--verbose", action="store_const", const=2, dest="verbosity"),
|
make_option("--verbose", action="store_const", const=2, dest="verbosity"),
|
||||||
make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"),
|
make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"),
|
||||||
make_option("-v", "--verbosity", action="count", dest="verbosity", default=1),
|
make_option("-v", "--verbosity", action="count", dest="verbosity", default=1),
|
||||||
|
make_option(
|
||||||
|
"--disable_capture", action="store_true", dest="disable_capture",
|
||||||
|
help="Disable capturing of stdout/stderr"
|
||||||
|
),
|
||||||
], share_with=['pavelib.utils.test.utils.clean_reports_dir'])
|
], share_with=['pavelib.utils.test.utils.clean_reports_dir'])
|
||||||
@PassthroughTask
|
@PassthroughTask
|
||||||
@timed
|
@timed
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class PytestSuite(TestSuite):
|
|||||||
self.django_toxenv = 'py27-django111'
|
self.django_toxenv = 'py27-django111'
|
||||||
else:
|
else:
|
||||||
self.django_toxenv = 'py27-django18'
|
self.django_toxenv = 'py27-django18'
|
||||||
|
self.disable_capture = kwargs.get('disable_capture', None)
|
||||||
self.report_dir = Env.REPORT_DIR / self.root
|
self.report_dir = Env.REPORT_DIR / self.root
|
||||||
|
|
||||||
# If set, put reports for run in "unique" directories.
|
# If set, put reports for run in "unique" directories.
|
||||||
@@ -144,6 +145,9 @@ class SystemTestSuite(PytestSuite):
|
|||||||
elif self.verbosity > 1:
|
elif self.verbosity > 1:
|
||||||
cmd.append("--verbose")
|
cmd.append("--verbose")
|
||||||
|
|
||||||
|
if self.disable_capture:
|
||||||
|
cmd.append("-s")
|
||||||
|
|
||||||
if self.processes == -1:
|
if self.processes == -1:
|
||||||
cmd.append('-n auto')
|
cmd.append('-n auto')
|
||||||
cmd.append('--dist=loadscope')
|
cmd.append('--dist=loadscope')
|
||||||
@@ -230,6 +234,8 @@ class LibTestSuite(PytestSuite):
|
|||||||
cmd.append("--quiet")
|
cmd.append("--quiet")
|
||||||
elif self.verbosity > 1:
|
elif self.verbosity > 1:
|
||||||
cmd.append("--verbose")
|
cmd.append("--verbose")
|
||||||
|
if self.disable_capture:
|
||||||
|
cmd.append("-s")
|
||||||
cmd.append(self.test_id)
|
cmd.append(self.test_id)
|
||||||
|
|
||||||
return self._under_coverage_cmd(cmd)
|
return self._under_coverage_cmd(cmd)
|
||||||
|
|||||||
@@ -111,13 +111,13 @@ case "$TEST_SUITE" in
|
|||||||
"lms-unit")
|
"lms-unit")
|
||||||
case "$SHARD" in
|
case "$SHARD" in
|
||||||
"all")
|
"all")
|
||||||
paver test_system -s lms $PAVER_ARGS $PARALLEL 2> lms-tests.log
|
paver test_system -s lms --disable_capture $PAVER_ARGS $PARALLEL 2> lms-tests.log
|
||||||
;;
|
;;
|
||||||
[1-3])
|
[1-3])
|
||||||
paver test_system -s lms --eval-attr="shard==$SHARD" $PAVER_ARGS $PARALLEL 2> lms-tests.$SHARD.log
|
paver test_system -s lms --disable_capture --eval-attr="shard==$SHARD" $PAVER_ARGS $PARALLEL 2> lms-tests.$SHARD.log
|
||||||
;;
|
;;
|
||||||
4|"noshard")
|
4|"noshard")
|
||||||
paver test_system -s lms --eval-attr='not shard' $PAVER_ARGS $PARALLEL 2> lms-tests.4.log
|
paver test_system -s lms --disable_capture --eval-attr='not shard' $PAVER_ARGS $PARALLEL 2> lms-tests.4.log
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# If no shard is specified, rather than running all tests, create an empty xunit file. This is a
|
# If no shard is specified, rather than running all tests, create an empty xunit file. This is a
|
||||||
@@ -131,11 +131,11 @@ case "$TEST_SUITE" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"cms-unit")
|
"cms-unit")
|
||||||
paver test_system -s cms $PAVER_ARGS 2> cms-tests.log
|
paver test_system -s cms --disable_capture $PAVER_ARGS 2> cms-tests.log
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"commonlib-unit")
|
"commonlib-unit")
|
||||||
paver test_lib $PAVER_ARGS 2> common-tests.log
|
paver test_lib --disable_capture $PAVER_ARGS 2> common-tests.log
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"js-unit")
|
"js-unit")
|
||||||
|
|||||||
Reference in New Issue
Block a user