Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unittest from TestCaseWithSimulator #642

Merged
merged 15 commits into from
Apr 10, 2024

Conversation

lekcyjna123
Copy link
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 tilk, xThaid and piotro888 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
@piotro888
Copy link
Member

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

@lekcyjna123
Copy link
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
8 checks passed
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