Skip to content

Commit

Permalink
Merge branch 'release/1.7.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
vmalloc committed Mar 4, 2019
2 parents 0174031 + 831e028 commit c370dd0
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ matrix:
include:
- python: "3.6"
env: TRAVIS_PYLINT=true
- os: windows
language: sh
python: "3.7"
before_install:
- choco install python3
- export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
- python -m pip install --upgrade pip wheel
script:
- python -m virtualenv .env
- .env/Scripts/pip.exe install -e .[testing,doc]
- .env/Scripts/py.test.exe --cov=slash --cov-report=html tests
allow_failures:
- os: windows

# command to run tests, e.g. python setup.py test
install:
Expand Down
3 changes: 3 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

* :release:`1.7.8 <04-03-2019>`
* :bug:`925` Fix background color for session start and test collection messages
* :bug:`926` Return code for failed sessions was changed to 1 (from -1)
* :release:`1.7.7 <21-01-2019>`
* :bug:`907` Fix parallel worker timeout issues
* :bug:`-` Fix test_start triggering when exceptions are thrown in class-based tests (thanks @pierreluctg)
Expand Down
2 changes: 1 addition & 1 deletion slash/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):
except Exception as e: # pylint: disable=broad-except
_logger.error("Failed to debug_if_needed: {!r}", e, exc_info=True, extra={'capture': False})
if exc_value is not None:
self._exit_code = exc_value.code if isinstance(exc_value, SystemExit) else -1
self._exit_code = exc_value.code if isinstance(exc_value, SystemExit) else 1

if should_inhibit_unhandled_exception_traceback(exc_value):
self.get_reporter().report_error_message(str(exc_value))
Expand Down
2 changes: 1 addition & 1 deletion slash/frontend/slash_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def slash_run(args, report_stream=None, resume=False, rerun=False, app_callback=
save_resume_state(app.session.results, collected)
clean_old_entries()
if app.exit_code == 0 and not app.session.results.is_success(allow_skips=True):
app.set_exit_code(-1)
app.set_exit_code(1)
except Exception: # pylint: disable=broad-except
# Error reporting happens in app context
assert app.exit_code != 0
Expand Down
4 changes: 2 additions & 2 deletions slash/reporting/console_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ def _report_num_collected(self, collected, stillworking):
return

self._terminal.write('{} tests collected{}'.format(
len(collected), '...' if stillworking else ' \n'), white=True, bold=True)
len(collected), '...' if stillworking else ' \n'), white=True, bold=True, Black=True)

def _is_verbose(self, level):
return self._level <= level

@from_verbosity(VERBOSITIES.ERROR)
def report_session_start(self, session):
self._terminal.sep('=', 'Session starts', white=True, bold=True)
self._terminal.sep('=', 'Session starts', white=True, bold=True, Black=True)

def report_session_end(self, session):

Expand Down
8 changes: 5 additions & 3 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=unused-argument,redefined-outer-name
import functools
import os
import sys

import logbook
import brotli
Expand Down Expand Up @@ -45,7 +46,7 @@ def test_with_log_error():
assert [res.message for res in result.get_errors()] == expected_error_messages
assert [rec.message for rec in test_handler.records] == [message, non_capture_message]


@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
def test_last_session_symlinks(files_dir, links_dir, session):

test_log_file = files_dir.join(
Expand Down Expand Up @@ -154,7 +155,7 @@ def test_log_symlinks_without_root_path(suite, config_override, symlink_name):
config_override('log.{}'.format(symlink_name), 'some/subdir')
assert suite.run().ok()


@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
def test_last_test_not_overriden_by_stop_on_error(links_dir, suite):
failed_test = suite[4]
failed_test.when_run.fail()
Expand Down Expand Up @@ -192,7 +193,7 @@ def test_result_log_links(files_dir, session):
assert result.get_log_path() is not None
assert result.get_log_path().startswith(str(files_dir))


@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
def test_last_failed(suite, links_dir):
suite[-5].when_run.fail()
last_failed = suite[-2]
Expand All @@ -216,6 +217,7 @@ def test_errors_log_for_test(suite, suite_test, errors_log_path, logs_dir):
lines = f.read().splitlines()
assert error_line in lines

@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
@pytest.mark.parametrize('should_keep_failed_tests', [True, False])
def test_logs_deletion(suite, suite_test, errors_log_path, logs_dir, config_override, should_keep_failed_tests):
config_override('log.cleanup.enabled', True)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_parallel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import slash
import os
import signal
import sys

from .utils.suite_writer import Suite
from slash.resuming import get_tests_from_previous_session
from slash.exceptions import InteractiveParallelNotAllowed, ParallelTimeout
Expand All @@ -12,6 +14,9 @@
import tempfile
import pytest

if sys.platform.startswith("win"):
pytest.skip("does not run on windows", allow_module_level=True)

@pytest.fixture(scope='module', autouse=True)
def no_parallel_user_config(request):
tmpdir = tempfile.mkdtemp()
Expand Down
3 changes: 2 additions & 1 deletion tests/test_site_customization.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ def _test_customize_via_local_slashrc(self, also_use_global):
with open(global_slashrc_path, "w") as f:
f.write(self.get_customization_source())

new_path = self.get_new_path()
self.addCleanup(os.chdir, os.path.abspath("."))
os.chdir(self.get_new_path())
os.chdir(new_path)
with open(".slashrc", "w") as f:
f.write(self.get_customization_source())
self.assert_customization_loaded()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_test_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_dir(tmpdir, names, indices):

@pytest.fixture
def names():
return ['a/test_a_b.py', 'a/test_b_a.py', 'b/test_a_a.py', 'b/test_a_b.py']
return [os.path.normpath(p) for p in ['a/test_a_b.py', 'a/test_b_a.py', 'b/test_a_a.py', 'b/test_a_b.py']]

def _sorted_by_indices(items, indices):
returned = [None for _ in items]
Expand Down
3 changes: 2 additions & 1 deletion tests/test_warnings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# pylint: disable=unused-variable,redefined-outer-name
import os
import collections
import warnings
from contextlib import contextmanager
Expand Down Expand Up @@ -44,7 +45,7 @@ def warning_added(warning):
assert isinstance(w.filename, str)
assert w.lineno
assert w.filename
assert w.filename.rsplit('/', 1)[-1] == suite_test.file.get_relative_path()
assert w.filename.rsplit(os.path.sep, 1)[-1] == suite_test.file.get_relative_path()
warning_type = w.details['type']
assert isinstance(warning_type, str)
assert warning_type == 'LogbookWarning'
Expand Down
2 changes: 2 additions & 0 deletions tests/test_xunit_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=redefined-outer-name
import os
import sys

import pytest

Expand Down Expand Up @@ -129,6 +130,7 @@ def func(test):
return func


@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
@pytest.mark.parametrize('action', ['skipped', 'error', 'failure', 'success'])
def test_xunit_parallel_suite(parallel_suite, xunit_filename, action):
test = parallel_suite[3]
Expand Down

0 comments on commit c370dd0

Please sign in to comment.