diff --git a/.travis.yml b/.travis.yml index dc75e6c8bad..eb5b9171fa8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,15 +12,8 @@ install: - python -m pip install --upgrade --pre tox env: matrix: - - TOXENV=py27 PYTEST_COVERAGE=1 - # Specialized factors for py27. - - TOXENV=py27-nobyte PYTEST_COVERAGE=1 - - TOXENV=py27-xdist PYTEST_COVERAGE=1 - - TOXENV=py27-pluggymaster-xdist # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy - - TOXENV=py37-pluggymaster-xdist - - TOXENV=py37-freeze matrix: allow_failures: @@ -29,29 +22,11 @@ matrix: jobs: include: - # Coverage tracking is slow with pypy, skip it. - - env: TOXENV=pypy-xdist - python: 'pypy2.7-6.0' - - env: TOXENV=pypy3-xdist - python: 'pypy3.5-6.0' - - - env: TOXENV=py34-xdist - python: '3.4' - - env: TOXENV=py35-xdist - python: '3.5' - - env: TOXENV=py36-xdist - python: '3.6' - - env: TOXENV=py37 - &test-macos os: osx osx_image: xcode10.1 language: generic - before_install: - - python -V - - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 - env: TOXENV=py27-xdist - - <<: *test-macos - env: TOXENV=py37-xdist + env: TOXENV=py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 - python3 -V @@ -59,16 +34,11 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - # Jobs only run via Travis cron jobs (currently daily). - - env: TOXENV=py38-xdist - python: '3.8-dev' - if: type = cron - - - stage: baseline - env: TOXENV=py27-pexpect,py27-trial,py27-numpy - - env: TOXENV=py37-xdist - - env: TOXENV=linting,docs,doctesting - python: '3.7' + # Coverage for: + # - pdb / _test_pytest_function ?! + # Regressed in e3eb26f. + # But I've expected it to come via py37-pexpect already. TODO: Verify! + - env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 - stage: deploy python: '3.6' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e27f03ee89e..a355726a5a4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,60 +17,39 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py27: - python.version: '2.7' - tox.env: 'py27' - PYTEST_COVERAGE: '1' - py27-xdist: - python.version: '2.7' - tox.env: 'py27-xdist' - PYTEST_COVERAGE: '1' py27-numpy/nobyte: python.version: '2.7' tox.env: 'py27-numpy,py27-nobyte' + # Coverage for: + # - test_supports_breakpoint_module_global + # - test_terminal_reporter_writer_attr (without xdist) + # - "if write" branch in _pytest.assertion.rewrite + # - also for more stable(?) isatty in _pytest.terminal + # (according to https://codecov.io/gh/pytest-dev/pytest/pull/4858/src/src/_pytest/terminal.py). PYTEST_COVERAGE: '1' py27-trial: python.version: '2.7' tox.env: 'py27-trial' python.needs_vc: True + # TODO: check if coverage is necessary/useful here. PYTEST_COVERAGE: '1' - py27-pluggymaster-xdist: - python.version: '2.7' - tox.env: 'py27-pluggymaster-xdist' - pypy: - python.version: 'pypy' - tox.env: 'pypy' - python.exe: 'pypy' - py34: + py34-xdist: python.version: '3.4' - tox.env: 'py34' + tox.env: 'py34-xdist' + # Coverage for: + # - _pytest.compat._bytes_to_ascii PYTEST_COVERAGE: '1' - py35: + py35-xdist: python.version: '3.5' - tox.env: 'py35' + tox.env: 'py35-xdist' + # Coverage for test_supports_breakpoint_module_global PYTEST_COVERAGE: '1' - py36: + py36-xdist: python.version: '3.6' - tox.env: 'py36' - PYTEST_COVERAGE: '1' - py37: - python.version: '3.7' - tox.env: 'py37' - PYTEST_COVERAGE: '1' - py37-linting/docs/doctesting: - python.version: '3.7' - tox.env: 'linting,docs,doctesting' - py37-xdist: - python.version: '3.7' - tox.env: 'py37-xdist' - PYTEST_COVERAGE: '1' - py37-trial/numpy: - python.version: '3.7' - tox.env: 'py37-trial,py37-numpy' + tox.env: 'py36-xdist' + # Coverage for: + # - _py36_windowsconsoleio_workaround (could also be py36+) PYTEST_COVERAGE: '1' - py37-pluggymaster-xdist: - python.version: '3.7' - tox.env: 'py37-pluggymaster-xdist' maxParallel: 10 steps: diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index fa878a485f3..234457a2f30 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -201,11 +201,14 @@ def _translate_non_printable(s): if PY35: + # TODO: only this is covered, but we have py37-xdist (osx)?! + # Might be good now via py36-xdist (linux). def _bytes_to_ascii(val): return val.decode("ascii", "backslashreplace") else: + # TODO: should get covered. def _bytes_to_ascii(val): if val: # source: http://goo.gl/bGsnwC diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index eda0c0905b8..6deabeb841d 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -487,8 +487,11 @@ def _width_of_current_line(self): return self._tw.chars_on_current_line def pytest_collection(self): + # TODO: should be covered now if self.isatty: - if self.config.option.verbose >= 0: + if ( + self.config.option.verbose >= 0 + ): # TODO: should be covered (true branch only) self.write("collecting ... ", bold=True) self._collect_report_last_write = time.time() elif self.config.option.verbose >= 1: diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 58d79845b73..df70e1e0faf 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -220,6 +220,7 @@ def runtest(self): if self.config.pluginmanager.get_plugin("pdbinvoke") is None: self._testcase(result=self) else: + # TODO: should be covered now # disables tearDown and cleanups for post mortem debugging (see #1890) if self._handle_skip(): return diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index 76498573694..fad0084527e 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -74,6 +74,8 @@ def catch_warnings_for_item(config, ihook, when, item): inifilters = config.getini("filterwarnings") with warnings.catch_warnings(record=True) as log: + # TODO: the False branch is not covered anymore, but was still in 9dcd6f2a. + # I could not find where `python -W` would be run from. if not sys.warnoptions: # if user is not explicitly configuring warning filters, show deprecation warnings by default (#2908) warnings.filterwarnings("always", category=DeprecationWarning) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 43d640614c1..4cf7268768d 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -149,6 +149,7 @@ def test_func(): @staticmethod def flush(child): + # TODO: should be covered now if platform.system() == "Darwin": return if child.isalive(): @@ -322,16 +323,12 @@ def pytest_runtest_protocol(): child.expect("Pdb") # INTERNALERROR is only displayed once via terminal reporter. - assert ( - len( - [ - x - for x in child.before.decode().splitlines() - if x.startswith("INTERNALERROR> Traceback") - ] - ) - == 1 - ) + error_lines = [ + x + for x in child.before.decode().splitlines() + if x.startswith("INTERNALERROR> Traceback") + ] # pragma: no branch + assert len(error_lines) == 1 child.sendeof() self.flush(child)