Repository: walles/pytest-avoidance (language: python)

Issue:
[RFC] Deselect tests instead of faking passed ones
Faking them is incomplete / different from how pytest does it (e.g. no
`pytest_runtest_logstart` before `pytest_runtest_logreport`, and doing
it from `pytest_collection_modifyitems` in the first place).


Discussion / hints:
Thanks for the PR!

I don't know how obvious this is, but CI is failing. Your commits have red crosses next to them and two out of three CI checks are listed as "failed".

To me CI failures means that the code doesn't work.

And as long as the code doesn't work there's no point for a human to review it.

If you want to reproduce the CI failures locally, you should be able to install `tox` and do `tox --skip-missing-interpreters`.

When the code works, do add me as a reviewer and I'll have a look at it.

Also, if you could provide a concrete example of what this change means for end users, that would be nice. As in "Before this change, if a test was avoided then XXX. With this change in place, you get YYY instead." Bonus points for providing output from actual test runs.
CI failures are only related to code style / typing - and can be easily addressed if the code makes sense in general.

Closing this as not really wanted for now - IIRC the idea here was to not fake reports, but deselect tests, since it is easier and the current faking of reports assumes a certain order of processing in pytest internals.

I'm not using pytest-avoidance myself (but only quickly looked at its code / gave it a spin), and came up with this.

> I don't know how obvious this is, but CI is failing. Your commits have red crosses next to them and two out of three CI checks are listed as "failed".
> 
> To me CI failures means that the code doesn't work.
> 
> And as long as the code doesn't work there's no point for a human to review it.

As a bystander — this seems combative and patronizing. 
I'm sorry if my tone was condescending, that was never my intention.

It was unclear to me what the expectation was from @blueyed given that CI was failing and nothing more was happening.

Given your outside perspective @max-sixty, I believe I should have communicated this uncertainty of mine differently.

Apologies @blueyed if I offended you.
Thanks for your thoughtful reply @walles 

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index c3d6cb0..37367a9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,13 +17,17 @@ matrix:
         env: TOX_ENV=py36
       - python: 3.7
         env: TOX_ENV=py37
+      - python: 3.8
+        env: TOX_ENV=py38
+      - python: 3.9
+        env: TOX_ENV=py39
       - python: 3.7
         env: TOX_ENV=wheel,py37-testwheel
       - python: 3.6
         env: TOX_ENV=flake8
-      - python: 3.7
+      - python: 3.8
         env: TOX_ENV=mypy2
-      - python: 3.7
+      - python: 3.8
         env: TOX_ENV=mypy3
 
 install:
diff --git a/README.rst b/README.rst
index 60c3646..9541f8f 100644
--- a/README.rst
+++ b/README.rst
@@ -14,10 +14,6 @@ pytest-avoidance
     :target: https://travis-ci.com/walles/pytest-avoidance
     :alt: See Build Status on Travis CI
 
-.. image:: https://ci.appveyor.com/api/projects/status/github/walles/pytest-avoidance?branch=master
-    :target: https://ci.appveyor.com/project/walles/pytest-avoidance/branch/master
-    :alt: See Build Status on AppVeyor
-
 Makes pytest skip tests that don't need rerunning
 
 
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index e562cb0..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-# What Python version is installed where:
-# http://www.appveyor.com/docs/installed-software#python
-
-environment:
-  matrix:
-    - PYTHON: "C:\\Python27"
-      TOX_ENV: "py27"
-
-    - PYTHON: "C:\\Python35"
-      TOX_ENV: "py35"
-
-    - PYTHON: "C:\\Python36"
-      TOX_ENV: "py36"
-
-    - PYTHON: "C:\\Python37"
-      TOX_ENV: "py37"
-
-init:
-  - "%PYTHON%/python -V"
-  - "%PYTHON%/python -c \"import struct;print( 8 * struct.calcsize(\'P\'))\""
-
-install:
-  - "%PYTHON%/Scripts/easy_install -U pip"
-  - "%PYTHON%/Scripts/pip install tox"
-  - "%PYTHON%/Scripts/pip install wheel"
-
-build: false  # Not a C# project, build stuff at the test step instead.
-
-test_script:
-  - "%PYTHON%/Scripts/tox -e %TOX_ENV%"
-
-after_test:
-  - "%PYTHON%/python setup.py bdist_wheel"
-  - ps: "ls dist"
-
-artifacts:
-  - path: dist\*
-
-#on_success:
-#  - TODO: upload the content of dist/*.whl to a public wheelhouse
diff --git a/setup.py b/setup.py
index 1376c32..cc93060 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ def read(fname):
     description='Makes pytest skip tests that don not need rerunning',
     long_description=read('README.rst'),
     py_modules=['pytest_avoidance'],
-    python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
+    python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
     install_requires=['pytest>=3.5.0', 'coverage==4.5.2'],
     classifiers=[
         'Development Status :: 4 - Beta',
@@ -47,6 +47,8 @@ def read(fname):
         'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
         'Programming Language :: Python :: Implementation :: CPython',
         'Operating System :: OS Independent',
         'License :: OSI Approved :: MIT License',
diff --git a/tox.ini b/tox.ini
index 94465e1..d880c1d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,11 @@
 # For more information about tox, see https://tox.readthedocs.io/en/latest/
 [tox]
-envlist = py27,py35,py36,py37,pypy,flake8,mypy2,mypy3,wheel,py27-testwheel,py37-testwheel
+envlist = py27,py35,py36,py37,py38,py39,pypy,flake8,mypy2,mypy3,wheel,py27-testwheel,py37-testwheel
+
+[flake8]
+# At the time of adding this value, it's what makes us pass.
+# Feel free to lower as long as CI passes.
+max-line-length = 146
 
 [testenv]
 setenv = GITDIR = {toxinidir}
@@ -12,12 +17,13 @@ whitelist_externals =
 [testenv:flake8]
 skip_install = true
 deps = flake8
-commands = flake8 *.py tests
+commands = sh -c "flake8 *.py tests"
 
 [testenv:mypy2]
-basepython = python3.7
+basepython = python3.8
 deps =
-    mypy==0.660
+    mypy==0.790
+    pytest==4.6.9  # 4.6.9 was the last version with Python 2 support
 setenv =
     MYPYPATH = {toxinidir}
 ignore_errors = True
@@ -25,9 +31,9 @@ commands =
     sh -c "mypy --py2 *.py tests"
 
 [testenv:mypy3]
-basepython = python3.7
+basepython = python3.8
 deps =
-    mypy==0.660
+    mypy==0.790
 setenv =
     MYPYPATH = {toxinidir}
 ignore_errors = True


Test patch:
diff --git a/pytest_avoidance.py b/pytest_avoidance.py
index f62b4f5..78e11e8 100644
--- a/pytest_avoidance.py
+++ b/pytest_avoidance.py
@@ -75,6 +75,7 @@ def get_depsfile_name(item):
 
     # From: https://github.com/pytest-dev/pytest/blob/9f9f6ee48beba8bbf0911e458590aa67b45bd867/src/_pytest/nodes.py#L290
     test_file, lineno = _pytest.nodes.get_fslocation_from_item(item)
+    test_file = str(test_file)
     if test_file[1] == ':':
         # Somebody on a Windows box, please test this
         test_file = test_file.replace(':', '/', 1)