diff options
author | Ivan Kolodyazhny <e0ne@e0ne.info> | 2020-09-03 18:11:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 18:11:55 +0300 |
commit | ef3f998c59c9358980e7e7e840d13df10e92c600 (patch) | |
tree | bcfa328d18fdd92525df3c1ee391f0475f65100a | |
parent | 36e8452b35d14ebdb32e308b219028ce2d8bfea0 (diff) | |
parent | 5d880813f9706f71f33d5fc585b36ffbf4dbfe75 (diff) | |
download | pyscss-ef3f998c59c9358980e7e7e840d13df10e92c600.tar.gz |
Merge pull request #408 from stanislavlevin/fix_pytest6
Add compatibility against Pytest 5.4+
-rw-r--r-- | conftest.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/conftest.py b/conftest.py index 535bb68..86c213a 100644 --- a/conftest.py +++ b/conftest.py @@ -58,7 +58,10 @@ def pytest_collect_file(path, parent): parts = str(path).split(path.sep) # -4 tests / -3 files / -2 directory / -1 file.scss if parts[-4:-2] == ['tests', 'files']: - return SassFile(path, parent) + if hasattr(SassFile, "from_parent"): + return SassFile.from_parent(parent, fspath=path) + else: + return SassFile(path, parent) class SassFile(pytest.File): @@ -67,7 +70,10 @@ class SassFile(pytest.File): if not fontforge and parent_name == 'fonts': pytest.skip("font tests require fontforge") - yield SassItem(str(self.fspath), self) + if hasattr(SassItem, "from_parent"): + yield SassItem.from_parent(parent=self, name=str(self.fspath)) + else: + yield SassItem(str(self.fspath), self) class SassItem(pytest.Item): |