Skip to content
Snippets Groups Projects
Commit c2b55947 authored by Hugo Winbladh's avatar Hugo Winbladh Committed by Oscar Gustafsson
Browse files

Drop pytest-mpl

parent 0747e2bf
Branches
No related tags found
1 merge request!419Drop pytest-mpl
Pipeline #100081 passed
Showing
with 14 additions and 10 deletions
...@@ -116,3 +116,4 @@ TODO.txt ...@@ -116,3 +116,4 @@ TODO.txt
b_asic/_version.py b_asic/_version.py
docs_sphinx/_build/ docs_sphinx/_build/
docs_sphinx/examples docs_sphinx/examples
result_images/
...@@ -23,7 +23,7 @@ before_script: ...@@ -23,7 +23,7 @@ before_script:
.run-test: .run-test:
stage: test stage: test
script: script:
- pytest --cov=b_asic --cov-report=xml:cov.xml --cov-report=term --cov-branch --color=yes test --mpl --timeout=20 --durations=10 - pytest --cov=b_asic --cov-report=xml:cov.xml --cov-report=term --cov-branch --color=yes test --timeout=20 --durations=10
# - lcov --capture --directory . --output-file coverage.info # - lcov --capture --directory . --output-file coverage.info
# - lcov --output-file coverage.info --extract coverage.info $PWD/src/'*' $PWD/b_asic/'*' # - lcov --output-file coverage.info --extract coverage.info $PWD/src/'*' $PWD/b_asic/'*'
# - lcov --list coverage.info # - lcov --list coverage.info
......
...@@ -127,13 +127,15 @@ pytest ...@@ -127,13 +127,15 @@ pytest
pytest --cov=b_asic --cov-report=html test pytest --cov=b_asic --cov-report=html test
``` ```
#### Test including plots #### Generate new baseline images for the tests
In `B-ASIC`:
``` ```
pytest --mpl pytest # The image comparison tests will fail
cp -a result_images/* test/baseline_images/
``` ```
### Generating documentation ### Generating documentation
``` ```
......
pytest pytest
pytest-cov pytest-cov
pytest-qt pytest-qt
pytest-mpl
pytest-timeout pytest-timeout
pytest-xvfb pytest-xvfb
pytest-xdist pytest-xdist
test/baseline/test__get_figure_no_execution_times.png

25.3 KiB

test/baseline/test_draw_matrix_transposer_4.png

26.8 KiB

test/baseline/test_draw_process_collection.png

14.7 KiB

test/baseline/test_left_edge_cell_assignment.png

22.5 KiB

test/baseline/test_max_min_lifetime_bar_plot.png

10.8 KiB

test/baseline_images/test_resources/test_draw_matrix_transposer_4.png

46.6 KiB

test/baseline_images/test_resources/test_draw_process_collection.png

25 KiB

test/baseline_images/test_resources/test_left_edge_cell_assignment.png

40.4 KiB

test/baseline_images/test_resources/test_max_min_lifetime_bar_plot.png

17.1 KiB

test/baseline_images/test_schedule/test__get_figure_no_execution_times.png

36.6 KiB

...@@ -2,6 +2,7 @@ import re ...@@ -2,6 +2,7 @@ import re
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import pytest import pytest
import matplotlib.testing.decorators
from b_asic.core_operations import ConstantMultiplication from b_asic.core_operations import ConstantMultiplication
from b_asic.process import PlainMemoryVariable from b_asic.process import PlainMemoryVariable
...@@ -13,13 +14,13 @@ from b_asic.resources import ProcessCollection, _ForwardBackwardTable ...@@ -13,13 +14,13 @@ from b_asic.resources import ProcessCollection, _ForwardBackwardTable
class TestProcessCollectionPlainMemoryVariable: class TestProcessCollectionPlainMemoryVariable:
@pytest.mark.mpl_image_compare(style='mpl20') @matplotlib.testing.decorators.image_comparison(['test_draw_process_collection.png'])
def test_draw_process_collection(self, simple_collection): def test_draw_process_collection(self, simple_collection):
fig, ax = plt.subplots() fig, ax = plt.subplots()
simple_collection.plot(ax=ax, show_markers=False) simple_collection.plot(ax=ax, show_markers=False)
return fig return fig
@pytest.mark.mpl_image_compare(style='mpl20') @matplotlib.testing.decorators.image_comparison(['test_draw_matrix_transposer_4.png'])
def test_draw_matrix_transposer_4(self): def test_draw_matrix_transposer_4(self):
fig, ax = plt.subplots() fig, ax = plt.subplots()
generate_matrix_transposer(4).plot(ax=ax) # type: ignore generate_matrix_transposer(4).plot(ax=ax) # type: ignore
...@@ -31,7 +32,7 @@ class TestProcessCollectionPlainMemoryVariable: ...@@ -31,7 +32,7 @@ class TestProcessCollectionPlainMemoryVariable:
) )
assert len(collection_split) == 3 assert len(collection_split) == 3
@pytest.mark.mpl_image_compare(style='mpl20') @matplotlib.testing.decorators.image_comparison(['test_left_edge_cell_assignment.png'])
def test_left_edge_cell_assignment(self, simple_collection: ProcessCollection): def test_left_edge_cell_assignment(self, simple_collection: ProcessCollection):
fig, ax = plt.subplots(1, 2) fig, ax = plt.subplots(1, 2)
assignment = list(simple_collection._left_edge_assignment()) assignment = list(simple_collection._left_edge_assignment())
...@@ -157,7 +158,7 @@ class TestProcessCollectionPlainMemoryVariable: ...@@ -157,7 +158,7 @@ class TestProcessCollectionPlainMemoryVariable:
assert len(simple_collection) == 7 assert len(simple_collection) == 7
assert new_proc not in simple_collection assert new_proc not in simple_collection
@pytest.mark.mpl_image_compare(style='mpl20') @matplotlib.testing.decorators.image_comparison(['test_max_min_lifetime_bar_plot.png'])
def test_max_min_lifetime_bar_plot(self): def test_max_min_lifetime_bar_plot(self):
fig, ax = plt.subplots() fig, ax = plt.subplots()
collection = ProcessCollection( collection = ProcessCollection(
......
...@@ -4,6 +4,7 @@ B-ASIC test suite for the schedule module and Schedule class. ...@@ -4,6 +4,7 @@ B-ASIC test suite for the schedule module and Schedule class.
import re import re
import pytest import pytest
import matplotlib.testing.decorators
from b_asic.core_operations import Addition, Butterfly, ConstantMultiplication from b_asic.core_operations import Addition, Butterfly, ConstantMultiplication
from b_asic.process import OperatorProcess from b_asic.process import OperatorProcess
...@@ -664,7 +665,7 @@ class TestProcesses: ...@@ -664,7 +665,7 @@ class TestProcesses:
class TestFigureGeneration: class TestFigureGeneration:
@pytest.mark.mpl_image_compare(remove_text=True, style='mpl20') @matplotlib.testing.decorators.image_comparison(['test__get_figure_no_execution_times.png'], remove_text=True)
def test__get_figure_no_execution_times(self, secondorder_iir_schedule): def test__get_figure_no_execution_times(self, secondorder_iir_schedule):
return secondorder_iir_schedule._get_figure() return secondorder_iir_schedule._get_figure()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment