tests: move out of the main package.
Compared to tests in the repository root, tests in the package have
many downsides:
* Unless explicitly excluded in find_packages(), tests and their
support code effectively become a part of public API.
This, unfortunately, happened with FHDLTestCase, which was never
intended for downstream use.
* Even if explicitly excluded from the setuptools package, using
an editable install, or setting PYTHONPATH still allows accessing
the tests.
* Having a sub-package that is present in the source tree but not
exported (or, worse, exported only sometimes) is confusing.
* The name `nmigen.test` cannot be used for anything else, such as
testing utilities that *are* intended for downstream use.
2020-08-26 18:33:31 -06:00
|
|
|
from nmigen.compat import *
|
|
|
|
from nmigen.compat.fhdl import verilog
|
|
|
|
from nmigen._utils import _ignore_deprecated
|
2018-12-18 11:05:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
class SimCase:
|
|
|
|
def setUp(self, *args, **kwargs):
|
2019-01-26 08:43:00 -07:00
|
|
|
with _ignore_deprecated():
|
|
|
|
self.tb = self.TestBench(*args, **kwargs)
|
2018-12-18 11:05:37 -07:00
|
|
|
|
2019-01-26 08:29:09 -07:00
|
|
|
def test_to_verilog(self):
|
|
|
|
verilog.convert(self.tb)
|
2018-12-18 11:05:37 -07:00
|
|
|
|
|
|
|
def run_with(self, generator):
|
2019-09-12 13:51:01 -06:00
|
|
|
with _ignore_deprecated():
|
|
|
|
run_simulation(self.tb, generator)
|