cocotb: Problems with MODULE

If the MODULE env variable is not set cocotb fails hard by raising (an ImportError of all things…) in the startup routine. It seems to me it should just run and exit with no failure because there are no tests to run.

MODULE might also accidentally contain trailing or leading separators, this isn’t handled, and tests show it fails in an ugly way. HOOKS, whose usefulness is debatable, suffers the same problem.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

To be clear, my claim above is that today, MODULE="file_with_no_tests" passes with no warnings and emits an empty results.xml.

I think the thing to do is:

  • Module not set: Error (like we do today, but with a clearer message)
  • Tests resolve to an empty list: Emit results.xml as normal (which we already do?), print a warning (which we currently don’t).

If the MODULE env variable is not set cocotb fails hard by raising (an ImportError of all things…) in the startup routine. It seems to me it should just run and exit with no failure because there are no tests to run.

I don’t agree, if it’s not set I then I think we should fail. The behavior you describe seems appropriate if it’s deliberately set to an empty string though.