Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated error type with newer pytest version #203

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions erpcgen/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ def pytest_configure(config):
# Files must start with "test" and have an extension of ".yml" to be processed.
def pytest_collect_file(parent, path):
if path.ext == ".yml" and path.basename.startswith("test"):
return ErpcgenFile(path, parent)
if hasattr(ErpcgenFile, "from_parent"):
return ErpcgenFile.from_parent(parent, fspath=path)
else:
return ErpcgenFile(path, parent)

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

## @brief Wraps an ErpcgenTestCase as a pytest test.
class ErpcgenItem(pytest.Item):
Expand Down Expand Up @@ -481,7 +487,7 @@ def run(self):
self._compiler.add_include(erpc_dir.join("erpc_c", "config"))
self._compiler.add_include(erpc_dir.join("erpc_c", "infra"))
self._compiler.add_include(self._out_dir)

# Add all server and client cpp files
for file in os.listdir(str(self._out_dir)):
if '.cpp' in file:
Expand Down