Skip to content

Drop unittest from TestCaseWithSimulator#642

Merged
tilk merged 15 commits into
kuznia-rdzeni:masterfrom
lekcyjna123:lekcyjna/remove-unittests
Apr 10, 2024
Merged

Drop unittest from TestCaseWithSimulator#642
tilk merged 15 commits into
kuznia-rdzeni:masterfrom
lekcyjna123:lekcyjna/remove-unittests

Conversation

@lekcyjna123
Copy link
Copy Markdown
Contributor

@lekcyjna123 lekcyjna123 commented Apr 2, 2024

In #553 #554 #611 we have added support for the pytest. This caused that we are supporting two testing libraries in parallel, which adds code and conceptual complexity to coreblocks. Particularly I have hit in that problem when adding the hypothesis in #573, where I had to integrate it with both unittest and pytest at the same time.

This PR want to drop unittest support and left only pytest. The most important changes are in TestCaseWithSimulator class where much of code from run_simulation was moved to separate fixtures. Whats more it was possible to drop the dirty trick with wrapping functions in DependencyContext.

There is a little drawback. If we want to use DependencyContext in setUp function we have to add one more line:

    @pytest.fixture(autouse=True)
    def setup(self, configure_dependency_context):

You can observe that in test/fu/functional_common.py. It is because we have to say that configure_dependency_context has to run before setup function.

ToDo:

  • Support for test execution
  • Support for profiles
  • Support for traces
  • Support for logging
  • Migrate some example tests
  • Migrate all tests to the new syntax

Please say what is your opinion about these changes? Are they ok for you and can I migrate all the tests?

@lekcyjna123 lekcyjna123 requested review from awariac, tilk and xThaid April 2, 2024 17:09
@lekcyjna123 lekcyjna123 marked this pull request as draft April 7, 2024 09:35
@lekcyjna123 lekcyjna123 marked this pull request as ready for review April 7, 2024 10:56
@awariac
Copy link
Copy Markdown
Member

awariac commented Apr 9, 2024

Some unit tests still use unitest.TestCase, is that intentional? unittest is also used in scripts.

@lekcyjna123
Copy link
Copy Markdown
Contributor Author

Good catch. I will prepare a separate review for that to doesn't delay this one.

@lekcyjna123 lekcyjna123 changed the title Drop unittest library support Drop unittest from TestCaseWithSimulator Apr 9, 2024
@tilk tilk merged commit d1646ab into kuznia-rdzeni:master Apr 10, 2024
github-actions Bot pushed a commit that referenced this pull request Apr 10, 2024
tilk pushed a commit to kuznia-rdzeni/transactron that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants