Sun, 03 Jun 2018 18:09:47 +0200
[test] add a conftest.py file with fixtures for prologix emulator setup in tests
pygpibtoolkit/test/conftest.py | file | annotate | diff | comparison | revisions |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pygpibtoolkit/test/conftest.py Sun Jun 03 18:09:47 2018 +0200 @@ -0,0 +1,20 @@ +import serial +import pygpibtoolkit.prologix_emulator as PE + +import pytest + + +@pytest.fixture(scope='session') +def newemulator(): + emul = PE.PrologixEmulator() + cnx = serial.Serial(emul.serialurl, timeout=0) + yield (emul, cnx) + emul.close() + cnx.close() + + +@pytest.fixture +def emulator(newemulator): + emul, cnx = newemulator + emul.reset() + return emul, cnx