-
Hi all, me again ^^ TL;DR: Is there an easy way to restrict a python unit test module's tests to just a few using their names (e.g. default tags)? I also left a few remarks below about my findings before posting here. We wanted to integrate our Avocado plugin's unit tests with Avocado itself, similarly to the way it is already done in Avocado's own unit tests. So I was looking through Avocado Test Writer’s Guide for examples of this like https://avocado-framework.readthedocs.io/en/91.0/guides/writer/chapters/writing.html#basic-example From what I gathered, I only have to subclass from
but I am not sure if this is an error yet or I missed something important in the documentation. AFAIU the stdout/stderr/output checking functionality should only be enabled if one produces files at the level of the test (which I never did). I also read through the caveats section in and while the process isolation does make Finally, the tag restriction seems to be the only restriction possible and perhaps there are some default tags but I couldn't find the example usage anywhere in the documentation due to this warning there:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hi @clebergnu, @beraldoleal, @willianrampazzo, @ana, does anyone have an idea about the restriction part? I am also now debugging the strange ERROR cases above, I suspect some of the unit test mocking might be causing it as it only happens for this python module. The offensive lines seem to be the following: exists_patch = mock.patch('avocado_i2n.states.setup.os.path.exists',
self.mock_file_exists)
exists_patch.start()
self.addCleanup(exists_patch.stop) not sure how but patching with mock code like this seems to make Avocado expect a |
Beta Was this translation helpful? Give feedback.
-
Hi @pevogam , Based on the name of this discussion ("How to restrict and run standard python unit tests based on name"), is your original question about how to ask Avocado to run *standard Python Unit tests"? Avocado should be able to run any Python unittest. About the reference used, it should be the path to the test file, optionally followed by class and method name. Internally, the Now the |
Beta Was this translation helpful? Give feedback.
-
I am back and ready to resolve this (hopefully):
The expect file issue is no longer reproducible, must have been fixed in alter iterations before we could catch it. In any case, nobody minds stuff starting to work for free so I guess we are all rather happy about this outcome.
It could be that I am missing something but my difficulty here is mostly about the documentation. While I could easily find an entire "Filtering tests by tags" section at https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/tags.html# I did not find even a single example included there about much more regular restricting to file and unit test name. Something like
worked well (give or take the fact that it will result in >1 tests if I also have a test named |
Beta Was this translation helpful? Give feedback.
I am back and ready to resolve this (hopefully):
The expect file issue is no longer reproducible, must have been fixed in alter iterations before we could catch it. In any case, nobody minds stuff starting to work for free so I guess we are all rather happy about this outcome.
It could be that I am missing something but my difficulty here is mostly about the documentation. While I could easily find an entire "Filtering tests by tags" section at https://avocado-framework.readthedocs.io/en/late…