Skip to content

Commit 7af8c7f

Browse files
Merge pull request #203 from ACRIOS-Systems/feature/update_pytest
Fix deprecated error type with newer pytest version
2 parents b94a617 + 280e5c6 commit 7af8c7f

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

erpcgen/test/conftest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ def pytest_configure(config):
139139
# Files must start with "test" and have an extension of ".yml" to be processed.
140140
def pytest_collect_file(parent, path):
141141
if path.ext == ".yml" and path.basename.startswith("test"):
142-
return ErpcgenFile(path, parent)
142+
if hasattr(ErpcgenFile, "from_parent"):
143+
return ErpcgenFile.from_parent(parent, fspath=path)
144+
else:
145+
return ErpcgenFile(path, parent)
143146

144147
## @brief Implements collection of erpcgen test cases from YAML files.
145148
#
@@ -154,7 +157,10 @@ def collect(self):
154157
name = d.get('name', self.fspath.purebasename + str(n)).replace(' ', '_')
155158
spec = ErpcgenTestSpec(name, self.fspath, d, verbosity)
156159
for case in spec:
157-
yield ErpcgenItem(case.desc, self, case)
160+
if hasattr(ErpcgenItem, "from_parent"):
161+
yield ErpcgenItem.from_parent(self, name=case.desc, case=case)
162+
else:
163+
yield ErpcgenItem(case.desc, self, case)
158164

159165
## @brief Wraps an ErpcgenTestCase as a pytest test.
160166
class ErpcgenItem(pytest.Item):
@@ -481,7 +487,7 @@ def run(self):
481487
self._compiler.add_include(erpc_dir.join("erpc_c", "config"))
482488
self._compiler.add_include(erpc_dir.join("erpc_c", "infra"))
483489
self._compiler.add_include(self._out_dir)
484-
490+
485491
# Add all server and client cpp files
486492
for file in os.listdir(str(self._out_dir)):
487493
if '.cpp' in file:

0 commit comments

Comments
 (0)