Sfoglia il codice sorgente

test: [producers] add test_produce() functionality

Uses unittest.mock.path to patch out call to matplotlib.pyplot.savefig()

TODO: better, more-granular tests of the bits of functionality here
main
Rob Hallam 2 mesi fa
parent
commit
445efac7f3
1 ha cambiato i file con 10 aggiunte e 2 eliminazioni
  1. +10
    -2
      test/test_producers.py

+ 10
- 2
test/test_producers.py Vedi File

@@ -70,8 +70,16 @@ class TestVisualisationProducer(unittest.TestCase):

def test_produce(self):
"""Test we can call produce without error"""
# TODO
pass
# to do this, we need to mock out plt.savefig(path)
feature = mocks.MockFeature(interval=mocks.MockInterval(start=0, end=5),
source=mocks.MockSource(path="test.mp4"))
features = [feature]
visprod = producers.VisualisationProducer(features=features)
with unittest.mock.patch("matplotlib.pyplot.savefig") as mock_savefig:
visprod.produce()
mock_savefig.assert_called()

# TODO: more more granular test coverage of produce behaviour

class TestJSONProducer(unittest.TestCase):
def test_init_empty(self):


Caricamento…
Annulla
Salva