summaryrefslogtreecommitdiff
path: root/grc/tests/test_examples.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/tests/test_examples.py')
-rw-r--r--grc/tests/test_examples.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/grc/tests/test_examples.py b/grc/tests/test_examples.py
index 2b590a4a94..ecc37f0c98 100644
--- a/grc/tests/test_examples.py
+++ b/grc/tests/test_examples.py
@@ -14,12 +14,14 @@ except FileExistsError:
# Gather blocks
BLOCK_PATHS = []
ROOT = path.join(path.dirname(__file__), '../..')
-BLOCK_PATHS = [path.join(path.dirname(__file__), '../../grc/blocks'), '../../build/gr-uhd/grc']
+BLOCK_PATHS = [path.join(path.dirname(
+ __file__), '../../grc/blocks'), '../../build/gr-uhd/grc']
for file_dir in os.scandir(ROOT):
# If it is a module
if path.isdir(file_dir) and file_dir.name.startswith("gr-"):
BLOCK_PATHS.append(path.join(file_dir, "grc"))
+
def gather_examples():
global ROOT
example_paths = []
@@ -39,11 +41,13 @@ def gather_examples():
continue
return example_paths
+
def print_proper(element):
if element.is_block:
return element.name
return f"{element.parent.name} - {element}"
+
@pytest.mark.examples
@pytest.mark.parametrize("example", gather_examples())
def test_all_examples(example):
@@ -62,7 +66,9 @@ def test_all_examples(example):
flow_graph.rewrite()
flow_graph.validate()
- assert flow_graph.is_valid(), (example.name, [f"{print_proper(elem)}: {msg}" for elem, msg in flow_graph.iter_error_messages()])
+ assert flow_graph.is_valid(), (example.name, [
+ f"{print_proper(elem)}: {msg}" for elem, msg in flow_graph.iter_error_messages()])
- generator = platform.Generator(flow_graph, path.join(path.dirname(__file__), 'resources/tests'))
+ generator = platform.Generator(flow_graph, path.join(
+ path.dirname(__file__), 'resources/tests'))
generator.write()