Skip to content

Commit

Permalink
Deprecate the partial flag
Browse files Browse the repository at this point in the history
The partial flag is vestigial and left over from the original testr fork.
It was originally used to indicate a run did not execute the entire test
suite. However this doesn't really come into play anywhere else and
it's not stored in the repository either. I think the eventual intent
was to treat those records as incomplete for other purposes but that
never really was implemented. With the introduction of load to run-id
and also a run --combine this isn't really needed anymore either. It's not
really something that should be user facing either. The user shouldn't
have to tell the runner whether the run is the full suite or not.

This commit removes the functional bits from the cli (and their python
api commands) and deprecates all the flags for partial. The repository
partial usage remains intact because it's coupled to how the file
repository runs. (it uses a memory repository with partial=True before
writing it to disk) So more care is needed before we rip that out, but
in the mean time this removes and deprecates all the end user facing
pieces.

Closes issue #108
  • Loading branch information
mtreinish committed Oct 25, 2017
1 parent b4c2707 commit dd11975
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
19 changes: 12 additions & 7 deletions stestr/commands/load.py
Expand Up @@ -16,6 +16,7 @@
import datetime
import functools
import sys
import warnings

import subunit
import testtools
Expand All @@ -31,7 +32,9 @@
def set_cli_opts(parser):
parser.add_argument("--partial", action="store_true",
default=False,
help="The stream being loaded was a partial run.")
help="DEPRECATED: The stream being loaded was a "
"partial run. This option is deprecated and no "
"does anything. It will be removed in the future")
parser.add_argument("--force-init", action="store_true",
default=False,
help="Initialise the repository if it does not exist "
Expand Down Expand Up @@ -59,9 +62,6 @@ def get_cli_help():
Failing tests are shown on the console and a summary of the stream is
printed at the end.
Unless the stream is a partial stream, any existing failures are
discarded.
"""
return help_str

Expand Down Expand Up @@ -90,7 +90,9 @@ def load(force_init=False, in_streams=None,
been created.
:param list in_streams: A list of file objects that will be saved into the
repository
:param bool partial: Specify the input is a partial stream
:param bool partial: DEPRECATED: Specify the input is a partial stream.
This option is deprecated and no longer does anything. It will be
removed in the future.
:param bool subunit_out: Output the subunit stream to stdout
:param str repo_type: This is the type of repository to use. Valid choices
are 'file' and 'sql'.
Expand All @@ -108,6 +110,9 @@ def load(force_init=False, in_streams=None,
for failures.
:rtype: int
"""
if partial:
warnings.warn('The partial flag is deprecated and has no effect '
'anymore')

try:
repo = util.get_repo_open(repo_type, repo_url)
Expand Down Expand Up @@ -141,9 +146,9 @@ def make_tests():

case = testtools.ConcurrentStreamTestSuite(make_tests)
if not run_id:
inserter = repo.get_inserter(partial=partial)
inserter = repo.get_inserter()
else:
inserter = repo.get_inserter(partial=partial, run_id=run_id)
inserter = repo.get_inserter(run_id=run_id)
if subunit_out:
output_result, summary_result = output.make_result(inserter.get_id,
output=stdout)
Expand Down
24 changes: 13 additions & 11 deletions stestr/commands/run.py
Expand Up @@ -15,6 +15,7 @@
import os
import subprocess
import sys
import warnings

import six
import subunit
Expand Down Expand Up @@ -42,8 +43,10 @@ def set_cli_opts(parser):
parser.add_argument("--load-list", default=None,
help="Only run tests listed in the named file."),
parser.add_argument("--partial", action="store_true", default=False,
help="Only some tests will be run. Implied by "
"--failing.")
help="DEPRECATED: Only some tests will be run. Implied"
" by --failing. This option is deprecated and no "
"longer does anything. It will be removed in the "
"future")
parser.add_argument("--subunit", action="store_true", default=False,
help="Display results in subunit format.")
parser.add_argument("--until-failure", action="store_true", default=False,
Expand Down Expand Up @@ -159,7 +162,9 @@ def run_command(config='.stestr.conf', repo_type='file',
autodetects your CPU count and uses that.
:param str load_list: The path to a list of test_ids. If specified only
tests listed in the named file will be run.
:param bool partial: Only some tests will be run. Implied by `--failing`.
:param bool partial: DEPRECATED: Only some tests will be run. Implied by
`--failing`. This flag is deprecated because and doesn't do anything
it will be removed in a future release.
:param bool subunit_out: Display results in subunit format.
:param bool until_failure: Repeat the run again and again until failure
occurs.
Expand Down Expand Up @@ -194,6 +199,9 @@ def run_command(config='.stestr.conf', repo_type='file',
for failures.
:rtype: int
"""
if partial:
warnings.warn('The partial flag is deprecated and has no effect '
'anymore')
try:
repo = util.get_repo_open(repo_type, repo_url)
# If a repo is not found, and there a testr config exists just create it
Expand Down Expand Up @@ -221,7 +229,7 @@ def run_tests():
subprocess.Popen(run_cmd, shell=True,
stdout=subprocess.PIPE)))]
return load.load(in_streams=run_proc,
partial=partial, subunit_out=subunit_out,
subunit_out=subunit_out,
repo_type=repo_type,
repo_url=repo_url, run_id=combine_id,
pretty_out=pretty_out,
Expand Down Expand Up @@ -319,9 +327,6 @@ def run_tests():
abbreviate=abbreviate)
else:
# Where do we source data about the cause of conflicts.
# XXX: Should instead capture the run id in with the failing test
# data so that we can deal with failures split across many partial
# runs.
latest_run = repo.get_latest_run()
# Stage one: reduce the list of failing tests (possibly further
# reduced by testfilters) to eliminate fails-on-own tests.
Expand Down Expand Up @@ -372,14 +377,11 @@ def run_tests():
run_procs = [('subunit',
output.ReturnCodeToSubunit(
proc)) for proc in cmd.run_tests()]
partial = False
if (failing or analyze_isolation or isolated):
partial = True
if not run_procs:
stdout.write("The specified regex doesn't match with anything")
return 1
return load.load((None, None), in_streams=run_procs,
partial=partial, subunit_out=subunit_out,
subunit_out=subunit_out,
repo_type=repo_type,
repo_url=repo_url, run_id=combine_id,
pretty_out=pretty_out, color=color, stdout=stdout,
Expand Down
6 changes: 4 additions & 2 deletions stestr/repository/abstract.py
Expand Up @@ -75,8 +75,10 @@ def get_inserter(self, partial=False, run_id=None):
get_inserter() does not add timing data to streams: it should be
provided by the caller of get_inserter (e.g. commands.load).
:param partial: If True, the stream being inserted only executed some
tests rather than all the projects tests.
:param partial: DEPREACTED: If True, the stream being inserted only
executed some tests rather than all the projects tests. This
option is deprecated and no longer does anything. It will be
removed in the future.
:return an inserter: Inserters meet the extended TestResult protocol
that testtools 0.9.2 and above offer. The startTestRun and
stopTestRun methods in particular must be called.
Expand Down

0 comments on commit dd11975

Please sign in to comment.