Skip to content

Commit

Permalink
Merge pull request #188 from GuillaumeFavelier/maint_pytest_5.4.0
Browse files Browse the repository at this point in the history
Update to pytest 5.4.0 API
  • Loading branch information
Teemu committed Apr 26, 2020
2 parents 66f6d9f + b56fed4 commit 5a3f0cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Expand Up @@ -16,15 +16,16 @@ matrix:
python: 3.4
- env: TOXENV=py35-pytest39-supported-xdist
python: 3.5
- env: TOXENV=py36-pytest40-supported-xdist
- env: TOXENV=py36-pytest40-supported-xdist-pinned-attrs
python: 3.6

- env: TOXENV=py37-pytest41-supported-xdist
- env: TOXENV=py37-pytest42-supported-xdist
- env: TOXENV=py37-pytest42-unsupported-xdist-rerunfailures
- env: TOXENV=py37-pytest41-supported-xdist-pinned-attrs
- env: TOXENV=py37-pytest42-supported-xdist-pinned-attrs
- env: TOXENV=py37-pytest42-unsupported-xdist-rerunfailures-pinned-attrs
- env: TOXENV=py37-pytest46-supported-xdist

# Latest pytest.
- env: TOXENV=py37-pytest46-supported-xdist
- env: TOXENV=py37-pytest54-supported-xdist

- env: TOXENV=qa
install: pip install -U tox
Expand Down
9 changes: 4 additions & 5 deletions pytest_sugar.py
Expand Up @@ -211,7 +211,6 @@ def pytest_report_teststatus(report):
class SugarTerminalReporter(TerminalReporter):
def __init__(self, reporter):
TerminalReporter.__init__(self, reporter.config)
self.writer = self._tw
self.paths_left = []
self.tests_count = 0
self.tests_taken = 0
Expand Down Expand Up @@ -339,14 +338,14 @@ def get_progress_bar():
def overwrite(self, line, rel_line_num):
# Move cursor up rel_line_num lines
if rel_line_num > 0:
self.writer.write("\033[%dA" % rel_line_num)
self.write("\033[%dA" % rel_line_num)

# Overwrite the line
self.writer.write("\r%s" % line)
self.write("\r%s" % line)

# Return cursor to original line
if rel_line_num > 0:
self.writer.write("\033[%dB" % rel_line_num)
self.write("\033[%dB" % rel_line_num)

def get_max_column_for_test_status(self):
return (
Expand Down Expand Up @@ -389,7 +388,7 @@ def begin_new_line(self, report, print_filename):
else:
self.current_lines[path] = " " * (2 + len(fspath))
self.current_line_nums[path] = self.current_line_num
self.writer.write("\r\n")
self.write("\r\n")

def reached_last_column_for_test_status(self, report):
len_line = real_string_length(
Expand Down
4 changes: 2 additions & 2 deletions test_sugar.py
Expand Up @@ -547,7 +547,7 @@ def doctest(self):
\"\"\"
"""
)
result = testdir.runpytest('--force-sugar', '--doctest-module')
result = testdir.runpytest('--force-sugar', '--doctest-modules')

assert result.ret == 1, result.stderr.str()

Expand All @@ -567,7 +567,7 @@ def foobar():
raise NotImplementedError
"""
)
result = testdir.runpytest('--force-sugar', '--doctest-module')
result = testdir.runpytest('--force-sugar', '--doctest-modules')

assert result.ret == 1, result.stderr.str()
result.stdout.fnmatch_lines([
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Expand Up @@ -17,10 +17,12 @@ deps =
pytest44: pytest>=4.4,<4.5
pytest45: pytest>=4.5,<4.6
pytest46: pytest>=4.6,<4.7
pytest54: pytest>=5.4,<5.5
termcolor>=1.1.0
supported-xdist: pytest-xdist{env:_TOX_SUGAR_XDIST_VERSION:>=1.14}
unsupported-xdist: pytest-xdist<1.14
rerunfailures: pytest-rerunfailures
pinned-attrs: attrs<19.2
setenv =
# pytest-xdist >= 1.28 requires pytest 4.4
pytest{36,37,38,39,310,40,41,42,43}: _TOX_SUGAR_XDIST_VERSION=>=1.14,<1.28
Expand Down

0 comments on commit 5a3f0cc

Please sign in to comment.