cocotb 1.7.2__cp38-cp38-win_amd64.whl → 1.8.0rc1__cp38-cp38-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cocotb might be problematic. Click here for more details.
- cocotb/__init__.py +7 -18
- cocotb/_sim_versions.py +16 -1
- cocotb/_version.py +1 -1
- cocotb/clock.py +8 -3
- cocotb/decorators.py +40 -318
- cocotb/ipython_support.py +3 -1
- cocotb/libs/cocotb.dll +0 -0
- cocotb/libs/cocotb.exp +0 -0
- cocotb/libs/cocotb.lib +0 -0
- cocotb/libs/cocotbfli_modelsim.dll +0 -0
- cocotb/libs/cocotbfli_modelsim.exp +0 -0
- cocotb/libs/cocotbfli_modelsim.lib +0 -0
- cocotb/libs/cocotbutils.dll +0 -0
- cocotb/libs/cocotbutils.exp +0 -0
- cocotb/libs/cocotbutils.lib +0 -0
- cocotb/libs/cocotbvhpi_aldec.dll +0 -0
- cocotb/libs/cocotbvhpi_aldec.exp +0 -0
- cocotb/libs/cocotbvhpi_aldec.lib +0 -0
- cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
- cocotb/libs/cocotbvpi_aldec.dll +0 -0
- cocotb/libs/cocotbvpi_aldec.exp +0 -0
- cocotb/libs/cocotbvpi_aldec.lib +0 -0
- cocotb/libs/cocotbvpi_ghdl.dll +0 -0
- cocotb/libs/cocotbvpi_ghdl.exp +0 -0
- cocotb/libs/cocotbvpi_ghdl.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.exp +0 -0
- cocotb/libs/cocotbvpi_icarus.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.vpl +0 -0
- cocotb/libs/cocotbvpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvpi_modelsim.lib +0 -0
- cocotb/libs/embed.dll +0 -0
- cocotb/libs/embed.exp +0 -0
- cocotb/libs/embed.lib +0 -0
- cocotb/libs/gpi.dll +0 -0
- cocotb/libs/gpi.exp +0 -0
- cocotb/libs/gpi.lib +0 -0
- cocotb/libs/gpilog.dll +0 -0
- cocotb/libs/gpilog.exp +0 -0
- cocotb/libs/gpilog.lib +0 -0
- cocotb/libs/pygpilog.dll +0 -0
- cocotb/libs/pygpilog.exp +0 -0
- cocotb/libs/pygpilog.lib +0 -0
- cocotb/regression.py +32 -14
- cocotb/runner.py +538 -453
- cocotb/scheduler.py +35 -18
- cocotb/share/def/aldec.exp +0 -0
- cocotb/share/def/aldec.lib +0 -0
- cocotb/share/def/ghdl.exp +0 -0
- cocotb/share/def/ghdl.lib +0 -0
- cocotb/share/def/icarus.exp +0 -0
- cocotb/share/def/icarus.lib +0 -0
- cocotb/share/def/modelsim.def +2 -0
- cocotb/share/def/modelsim.exp +0 -0
- cocotb/share/def/modelsim.lib +0 -0
- cocotb/share/include/embed.h +1 -2
- cocotb/share/include/gpi.h +10 -15
- cocotb/share/include/vpi_user_ext.h +3 -0
- cocotb/share/lib/verilator/verilator.cpp +8 -4
- cocotb/share/makefiles/Makefile.inc +16 -4
- cocotb/share/makefiles/Makefile.sim +2 -2
- cocotb/share/makefiles/simulators/Makefile.icarus +19 -0
- cocotb/share/makefiles/simulators/Makefile.ius +12 -1
- cocotb/share/makefiles/simulators/Makefile.questa +2 -1
- cocotb/share/makefiles/simulators/Makefile.riviera +4 -0
- cocotb/share/makefiles/simulators/Makefile.vcs +4 -0
- cocotb/share/makefiles/simulators/Makefile.verilator +5 -1
- cocotb/share/makefiles/simulators/Makefile.xcelium +5 -1
- cocotb/simulator.cp38-win_amd64.exp +0 -0
- cocotb/simulator.cp38-win_amd64.lib +0 -0
- cocotb/simulator.cp38-win_amd64.pyd +0 -0
- cocotb/task.py +325 -0
- cocotb/triggers.py +23 -7
- cocotb/types/logic_array.py +34 -3
- {cocotb-1.7.2.dist-info → cocotb-1.8.0rc1.dist-info}/METADATA +24 -9
- cocotb-1.8.0rc1.dist-info/RECORD +120 -0
- {cocotb-1.7.2.dist-info → cocotb-1.8.0rc1.dist-info}/WHEEL +1 -1
- cocotb-1.7.2.dist-info/RECORD +0 -119
- {cocotb-1.7.2.dist-info → cocotb-1.8.0rc1.dist-info}/LICENSE +0 -0
- {cocotb-1.7.2.dist-info → cocotb-1.8.0rc1.dist-info}/entry_points.txt +0 -0
- {cocotb-1.7.2.dist-info → cocotb-1.8.0rc1.dist-info}/top_level.txt +0 -0
cocotb/regression.py
CHANGED
|
@@ -37,18 +37,18 @@ import sys
|
|
|
37
37
|
import time
|
|
38
38
|
import traceback
|
|
39
39
|
from itertools import product
|
|
40
|
-
from typing import Any, Iterable, Optional, Tuple
|
|
40
|
+
from typing import Any, Iterable, Optional, Tuple, Type
|
|
41
41
|
|
|
42
42
|
import cocotb
|
|
43
43
|
import cocotb.ANSI as ANSI
|
|
44
44
|
from cocotb import simulator
|
|
45
45
|
from cocotb._deprecation import deprecated
|
|
46
|
-
from cocotb.decorators import Task
|
|
47
46
|
from cocotb.decorators import test as Test
|
|
48
47
|
from cocotb.handle import SimHandle
|
|
49
48
|
from cocotb.log import SimLog
|
|
50
49
|
from cocotb.outcomes import Error, Outcome
|
|
51
50
|
from cocotb.result import SimFailure, TestSuccess
|
|
51
|
+
from cocotb.task import Task
|
|
52
52
|
from cocotb.utils import get_sim_time, remove_traceback_frames, want_color_output
|
|
53
53
|
from cocotb.xunit_reporter import XUnitReporter
|
|
54
54
|
|
|
@@ -78,6 +78,20 @@ def _my_import(name: str) -> Any:
|
|
|
78
78
|
|
|
79
79
|
_logger = SimLog(__name__)
|
|
80
80
|
|
|
81
|
+
_Failed: Type[BaseException]
|
|
82
|
+
try:
|
|
83
|
+
import pytest
|
|
84
|
+
except ModuleNotFoundError:
|
|
85
|
+
_Failed = AssertionError
|
|
86
|
+
else:
|
|
87
|
+
try:
|
|
88
|
+
with pytest.raises(Exception):
|
|
89
|
+
pass
|
|
90
|
+
except BaseException as _raises_e:
|
|
91
|
+
_Failed = type(_raises_e)
|
|
92
|
+
else:
|
|
93
|
+
assert "pytest.raises doesn't raise an exception when it fails"
|
|
94
|
+
|
|
81
95
|
|
|
82
96
|
class RegressionManager:
|
|
83
97
|
"""Encapsulates all regression capability into a single place"""
|
|
@@ -250,11 +264,8 @@ class RegressionManager:
|
|
|
250
264
|
from _pytest.assertion import install_importhook
|
|
251
265
|
from _pytest.config import Config
|
|
252
266
|
|
|
253
|
-
# Pass python_files to Config to support assertion rewriting only on test modules.
|
|
254
|
-
# See https://github.com/pytest-dev/pytest/discussions/10052.
|
|
255
|
-
test_modules_str = " ".join(f"{name}.py" for name in test_modules)
|
|
256
267
|
pytest_conf = Config.fromdictargs(
|
|
257
|
-
{}, ["--capture=no", "-o",
|
|
268
|
+
{}, ["--capture=no", "-o", "python_files=*.py"]
|
|
258
269
|
)
|
|
259
270
|
install_importhook(pytest_conf)
|
|
260
271
|
except Exception:
|
|
@@ -394,7 +405,9 @@ class RegressionManager:
|
|
|
394
405
|
|
|
395
406
|
try:
|
|
396
407
|
outcome.get()
|
|
397
|
-
except
|
|
408
|
+
except (KeyboardInterrupt, SystemExit):
|
|
409
|
+
raise
|
|
410
|
+
except BaseException as e:
|
|
398
411
|
result = remove_traceback_frames(e, ["_score_test", "get"])
|
|
399
412
|
else:
|
|
400
413
|
result = TestSuccess()
|
|
@@ -406,9 +419,6 @@ class RegressionManager:
|
|
|
406
419
|
):
|
|
407
420
|
self._log_test_passed(test, None, None)
|
|
408
421
|
|
|
409
|
-
elif isinstance(result, AssertionError) and test.expect_fail:
|
|
410
|
-
self._log_test_passed(test, result, "failed as expected")
|
|
411
|
-
|
|
412
422
|
elif isinstance(result, TestSuccess) and test.expect_error:
|
|
413
423
|
self._log_test_failed(test, None, "passed but we expected an error")
|
|
414
424
|
result_pass = False
|
|
@@ -426,6 +436,9 @@ class RegressionManager:
|
|
|
426
436
|
# whether we expected it or not, the simulation has failed unrecoverably
|
|
427
437
|
sim_failed = True
|
|
428
438
|
|
|
439
|
+
elif isinstance(result, (AssertionError, _Failed)) and test.expect_fail:
|
|
440
|
+
self._log_test_passed(test, result, "failed as expected")
|
|
441
|
+
|
|
429
442
|
elif test.expect_error:
|
|
430
443
|
if isinstance(result, test.expect_error):
|
|
431
444
|
self._log_test_passed(test, result, "errored as expected")
|
|
@@ -455,7 +468,9 @@ class RegressionManager:
|
|
|
455
468
|
result_was = ""
|
|
456
469
|
else:
|
|
457
470
|
result_was = f" (result was {type(result).__qualname__})"
|
|
458
|
-
self.log.info(
|
|
471
|
+
self.log.info(
|
|
472
|
+
f"{test.__qualname__} {start_hilight}passed{stop_hilight}{rest}{result_was}"
|
|
473
|
+
)
|
|
459
474
|
|
|
460
475
|
def _log_test_failed(
|
|
461
476
|
self, test: Test, result: Optional[Exception] = None, msg: Optional[str] = None
|
|
@@ -467,7 +482,8 @@ class RegressionManager:
|
|
|
467
482
|
else:
|
|
468
483
|
rest = f": {msg}"
|
|
469
484
|
self.log.info(
|
|
470
|
-
f"{test} {start_hilight}failed{stop_hilight}{rest}",
|
|
485
|
+
f"{test.__qualname__} {start_hilight}failed{stop_hilight}{rest}",
|
|
486
|
+
exc_info=result,
|
|
471
487
|
)
|
|
472
488
|
|
|
473
489
|
def _record_result(
|
|
@@ -502,7 +518,9 @@ class RegressionManager:
|
|
|
502
518
|
else:
|
|
503
519
|
test_pass, sim_failed = self._score_test(test, outcome)
|
|
504
520
|
if not test_pass:
|
|
505
|
-
self.xunit.add_failure(
|
|
521
|
+
self.xunit.add_failure(
|
|
522
|
+
message=f"Test failed with RANDOM_SEED={cocotb.RANDOM_SEED}"
|
|
523
|
+
)
|
|
506
524
|
self.failures += 1
|
|
507
525
|
else:
|
|
508
526
|
self.passed += 1
|
|
@@ -892,7 +910,7 @@ def _trim(docstring: Optional[str]) -> str:
|
|
|
892
910
|
|
|
893
911
|
Based on https://www.python.org/dev/peps/pep-0257/#handling-docstring-indentation.
|
|
894
912
|
"""
|
|
895
|
-
if docstring is None:
|
|
913
|
+
if docstring is None or docstring == "":
|
|
896
914
|
return ""
|
|
897
915
|
# Convert tabs to spaces (following the normal Python rules)
|
|
898
916
|
# and split into a list of lines:
|