Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param bool all_attachments: When set true subunit_trace will print all
text attachments on successful test execution.
:param bool show_binary_attachments: When set to true, subunit_trace will
print binary attachments in addition to text attachments.
:return return_code: The exit code for the command. 0 for success and > 0
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)
except repository.RepositoryNotFound:
if force_init:
try:
repo = util.get_repo_initialise(repo_type, repo_url)
except OSError as e:
if e.errno != errno.EEXIST:
raise
repo_path = repo_url or './stestr'
stdout.write('The specified repository directory %s already '
'exists. Please check if the repository already '
'exists or select a different path\n'
% repo_path)
exit(1)
else:
raise
# Not a full implementation of TestCase, but we only need to iterate
# back to it. Needs to be a callable - its a head fake for
:param str pdb: Takes in a single test_id to bypasses test
discover and just execute the test specified without launching any
additional processes. A file name may be used in place of a test name.
:param bool dynamic: Enable dynamic scheduling
:return return_code: The exit code for the command. 0 for success and > 0
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
except repository.RepositoryNotFound:
if not os.path.isfile(config) and not test_path:
msg = ("No config file found and --test-path not specified. "
"Either create or specify a .stestr.conf or use "
"--test-path ")
stdout.write(msg)
exit(1)
try:
repo = util.get_repo_initialise(repo_type, repo_url)
except OSError as e:
if e.errno != errno.EEXIST:
raise
repo_path = repo_url or './stestr'
stdout.write('The specified repository directory %s already '
'exists. Please check if the repository already '
'exists or select a different path\n' % repo_path)
return 1
:param file stdout: The output file to write all output to. By default
this is sys.stdout
:param bool suppress_attachments: When set true attachments subunit_trace
will not print attachments on successful test execution.
:param bool all_attachments: When set true subunit_trace will print all
text attachments on successful test execution.
:param bool show_binary_attachments: When set to true, subunit_trace will
print binary attachments in addition to text attachments.
:return return_code: The exit code for the command. 0 for success and > 0
for failures.
:rtype: int
"""
try:
repo = util.get_repo_open(repo_type, repo_url)
except abstract.RepositoryNotFound as e:
stdout.write(str(e) + '\n')
return 1
try:
latest_run = repo.get_latest_run()
except KeyError as e:
stdout.write(str(e) + '\n')
return 1
if subunit_out:
stream = latest_run.get_subunit_stream()
output.output_stream(stream, output=stdout)
# Exits 0 if we successfully wrote the stream.
return 0
case = latest_run.get_test()
try:
def open(self, url):
repo = Repository(url)
# To test the repository's existence call get_ids_for_all_tests()
# if it raises an OperationalError that means the DB doesn't exist or
# it couldn't connect, either way the repository was not found.
try:
session = repo.session_factory()
db_api.get_ids_for_all_tests(session=session)
session.close()
except sqlalchemy.exc.OperationalError:
raise repository.RepositoryNotFound(url)
return repo
def open(self, url):
path = os.path.expanduser(url)
base = os.path.join(path, '.stestr')
try:
stream = open(os.path.join(base, 'format'), 'rt')
except (IOError, OSError) as e:
if e.errno == errno.ENOENT:
raise repository.RepositoryNotFound(url)
raise
with stream:
if '1\n' != stream.read():
raise ValueError(url)
return Repository(base)
def open(self, url):
try:
return self.repos[url]
except KeyError:
raise repository.RepositoryNotFound(url)