Repository: aequitas/pytest-eradicate (language: python)

Issue:
Compatibility with pytest 6
Hello, thank you for this interesting plugin. It seems it's not compatible with the latest pytest. the following error appear with pytest 6:

```
venv/lib/python3.8/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
venv/lib/python3.8/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
venv/lib/python3.8/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
venv/lib/python3.8/site-packages/pytest_eradicate.py:27: in pytest_collect_file
    return EradicateItem(path, parent)
venv/lib/python3.8/site-packages/_pytest/nodes.py:95: in __call__
    warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2)
E   pytest.PytestDeprecationWarning: Direct construction of EradicateItem has been deprecated, please use EradicateItem.from_parent.
E   See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details.
```

By downgrading to pytest <6 everything work correctly.


Discussion / hints:
Looks like a trivial change, I'll try and get it fixed later today of this week. Or if you want you can try it yourself and submit a PR.

Fix patch:
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..94840b3
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,1 @@
+layout python3
diff --git a/.github/main.workflow b/.github/main.workflow
deleted file mode 100644
index 083a840..0000000
--- a/.github/main.workflow
+++ /dev/null
@@ -1,9 +0,0 @@
-workflow "Test" {
-  on = "push"
-  resolves = ["test"]
-}
-
-action "test" {
-  uses = "docker://python:3.6"
-  runs = ["/bin/sh", "-c", "set -xe; pip install -e .; ! py.test --eradicate setup.py; py.test --eradicate ./pytest_eradicate.py"]
-}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index a6a7742..93b8244 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ build
 dist
 *.egg-info
 *.pyc
-*.idea
\ No newline at end of file
+*.idea
+.direnv/
diff --git a/README.md b/README.md
index 300d1d8..4a40791 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ pytest-eradicate
 Changes
 -------
 
+- **0.0.5** added compatability for Pytest 5.4 and higher
 - **0.0.4** made eradicate 1.0 compatible, added `--agressive` (thanks to @avallbona)
 
 Usage
diff --git a/setup.py b/setup.py
index 9e33932..a8e9c21 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@
         description='pytest plugin to check for commented out code',
         long_description=open(os.path.join(os.path.dirname(__file__), "README.md")).read(),
         license="MIT license",
-        version='0.0.4',
+        version='0.0.5',
         author='Johan Bloemberg',
         author_email='github@ijohan.nl',
         url='https://github.com/aequitas/pytest-eradicate',
@@ -20,9 +20,7 @@
         install_requires=['pytest-cache', 'pytest>=2.4.2', 'eradicate', ],
         classifiers=[
             'Programming Language :: Python',
-            'Programming Language :: Python :: 2.6',
-            'Programming Language :: Python :: 2.7',
-            'Programming Language :: Python :: 3.3',
-            'Programming Language :: Python :: 3.4'
+            'Programming Language :: Python :: 2.7'
+            'Programming Language :: Python :: 3.8'
         ],
     )


Test patch:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 0000000..e7836a6
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,28 @@
+name: Test
+
+on: [push]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [2.7, 3.8]
+        pytest-version: ["<5.4", ">6"]
+        exclude:
+          - python-version: 2.7
+            pytest-version: ">6"
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Set up Pytest ${{ matrix.pytest-version }}
+      run: pip install "pytest${{ matrix.pytest-version }}"
+    - name: Install
+      run: python setup.py develop
+    - name: Test
+      run: |
+        ! py.test --eradicate setup.py
+        py.test --eradicate pytest_eradicate.py
\ No newline at end of file
diff --git a/pytest_eradicate.py b/pytest_eradicate.py
index 075dc9a..dc31b23 100644
--- a/pytest_eradicate.py
+++ b/pytest_eradicate.py
@@ -24,7 +24,10 @@ def pytest_sessionstart(session):
 def pytest_collect_file(path, parent):
     config = parent.config
     if config.option.eradicate and path.ext == '.py':
-        return EradicateItem(path, parent)
+        if hasattr(EradicateItem, "from_parent"):
+            return EradicateItem.from_parent(parent, fspath=path)
+        else:
+            return EradicateItem(parent, path)
 
 
 def pytest_sessionfinish(session):
@@ -33,14 +36,19 @@ def pytest_sessionfinish(session):
         config.cache.set(HISTKEY, config._eradicatemtimes)
 
 
+def pytest_configure(config):
+    config.addinivalue_line(
+        "markers", "eradicate(name): mark eradicate tests"
+    )
+
 class EradicateError(Exception):
     """ indicates an error during eradicate checks. """
 
 
 class EradicateItem(pytest.Item, pytest.File):
 
-    def __init__(self, path, parent):
-        super(EradicateItem, self).__init__(path, parent)
+    def __init__(self, parent, fspath):
+        super(EradicateItem, self).__init__(fspath, parent)
         self.add_marker("eradicate")
 
     def setup(self):