cocotb 1.7.1__cp310-cp310-win32.whl → 1.8.0rc1__cp310-cp310-win32.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.

Files changed (87) hide show
  1. cocotb/__init__.py +7 -18
  2. cocotb/_sim_versions.py +16 -1
  3. cocotb/_version.py +1 -1
  4. cocotb/clock.py +8 -3
  5. cocotb/config.py +2 -1
  6. cocotb/decorators.py +40 -318
  7. cocotb/ipython_support.py +3 -1
  8. cocotb/libs/cocotb.dll +0 -0
  9. cocotb/libs/cocotb.exp +0 -0
  10. cocotb/libs/cocotb.lib +0 -0
  11. cocotb/libs/cocotbfli_modelsim.dll +0 -0
  12. cocotb/libs/cocotbfli_modelsim.exp +0 -0
  13. cocotb/libs/cocotbfli_modelsim.lib +0 -0
  14. cocotb/libs/cocotbutils.dll +0 -0
  15. cocotb/libs/cocotbutils.exp +0 -0
  16. cocotb/libs/cocotbutils.lib +0 -0
  17. cocotb/libs/cocotbvhpi_aldec.dll +0 -0
  18. cocotb/libs/cocotbvhpi_aldec.exp +0 -0
  19. cocotb/libs/cocotbvhpi_aldec.lib +0 -0
  20. cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
  21. cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
  22. cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
  23. cocotb/libs/cocotbvpi_aldec.dll +0 -0
  24. cocotb/libs/cocotbvpi_aldec.exp +0 -0
  25. cocotb/libs/cocotbvpi_aldec.lib +0 -0
  26. cocotb/libs/cocotbvpi_ghdl.dll +0 -0
  27. cocotb/libs/cocotbvpi_ghdl.exp +0 -0
  28. cocotb/libs/cocotbvpi_ghdl.lib +0 -0
  29. cocotb/libs/cocotbvpi_icarus.exp +0 -0
  30. cocotb/libs/cocotbvpi_icarus.lib +0 -0
  31. cocotb/libs/cocotbvpi_icarus.vpl +0 -0
  32. cocotb/libs/cocotbvpi_modelsim.dll +0 -0
  33. cocotb/libs/cocotbvpi_modelsim.exp +0 -0
  34. cocotb/libs/cocotbvpi_modelsim.lib +0 -0
  35. cocotb/libs/embed.dll +0 -0
  36. cocotb/libs/embed.exp +0 -0
  37. cocotb/libs/embed.lib +0 -0
  38. cocotb/libs/gpi.dll +0 -0
  39. cocotb/libs/gpi.exp +0 -0
  40. cocotb/libs/gpi.lib +0 -0
  41. cocotb/libs/gpilog.dll +0 -0
  42. cocotb/libs/gpilog.exp +0 -0
  43. cocotb/libs/gpilog.lib +0 -0
  44. cocotb/libs/pygpilog.dll +0 -0
  45. cocotb/libs/pygpilog.exp +0 -0
  46. cocotb/libs/pygpilog.lib +0 -0
  47. cocotb/regression.py +32 -14
  48. cocotb/runner.py +541 -454
  49. cocotb/scheduler.py +35 -18
  50. cocotb/share/def/aldec.exp +0 -0
  51. cocotb/share/def/aldec.lib +0 -0
  52. cocotb/share/def/ghdl.exp +0 -0
  53. cocotb/share/def/ghdl.lib +0 -0
  54. cocotb/share/def/icarus.exp +0 -0
  55. cocotb/share/def/icarus.lib +0 -0
  56. cocotb/share/def/modelsim.def +2 -0
  57. cocotb/share/def/modelsim.exp +0 -0
  58. cocotb/share/def/modelsim.lib +0 -0
  59. cocotb/share/include/embed.h +1 -2
  60. cocotb/share/include/gpi.h +10 -15
  61. cocotb/share/include/vpi_user_ext.h +3 -0
  62. cocotb/share/lib/verilator/verilator.cpp +8 -4
  63. cocotb/share/makefiles/Makefile.inc +16 -4
  64. cocotb/share/makefiles/Makefile.sim +2 -2
  65. cocotb/share/makefiles/simulators/Makefile.icarus +19 -0
  66. cocotb/share/makefiles/simulators/Makefile.ius +12 -1
  67. cocotb/share/makefiles/simulators/Makefile.questa +2 -1
  68. cocotb/share/makefiles/simulators/Makefile.riviera +4 -0
  69. cocotb/share/makefiles/simulators/Makefile.vcs +4 -0
  70. cocotb/share/makefiles/simulators/Makefile.verilator +5 -1
  71. cocotb/share/makefiles/simulators/Makefile.xcelium +5 -1
  72. cocotb/simulator.cp310-win32.exp +0 -0
  73. cocotb/simulator.cp310-win32.lib +0 -0
  74. cocotb/simulator.cp310-win32.pyd +0 -0
  75. cocotb/task.py +325 -0
  76. cocotb/triggers.py +23 -7
  77. cocotb/types/logic_array.py +34 -3
  78. {cocotb-1.7.1.dist-info → cocotb-1.8.0rc1.dist-info}/METADATA +166 -149
  79. cocotb-1.8.0rc1.dist-info/RECORD +120 -0
  80. {cocotb-1.7.1.dist-info → cocotb-1.8.0rc1.dist-info}/WHEEL +1 -1
  81. cocotb/_vendor/find_libpython/__init__.py +0 -358
  82. cocotb/_vendor/find_libpython/__main__.py +0 -5
  83. cocotb/_vendor/find_libpython/_version.py +0 -5
  84. cocotb-1.7.1.dist-info/RECORD +0 -122
  85. {cocotb-1.7.1.dist-info → cocotb-1.8.0rc1.dist-info}/LICENSE +0 -0
  86. {cocotb-1.7.1.dist-info → cocotb-1.8.0rc1.dist-info}/entry_points.txt +0 -0
  87. {cocotb-1.7.1.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", f"python_files={test_modules_str}"]
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 Exception as e:
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(f"{test} {start_hilight}passed{stop_hilight}{rest}{result_was}")
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}", exc_info=result
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: