canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
35 stars 43 forks source link

refactor unit tests to simplify the use of fixtures #37

Closed cjdcordeiro closed 2 years ago

cjdcordeiro commented 2 years ago

It would be simpler to use mocker instead in most cases.

For example, in test_oci.py:

@pytest.fixture
def mock_run(mocker):
    yield mocker.patch("rockcraft.oci._process_run")

could be deleted and instead a mocker could be used in whatever test methods need this fixture.

SamirPS commented 2 years ago

This issue is solved or i can try it ?

cjdcordeiro commented 2 years ago

This issue is solved or i can try it ?

this might not be needed anymore. we'll need to groom it at some point cause it's not too relevant for now ;)

SamirPS commented 2 years ago

Okay, thanks for you answer, if you have some good first time issue tell me

cjdcordeiro commented 2 years ago

Okay, thanks for you answer, if you have some good first time issue tell me

thanks for wanting to contribute :pray:

we usually use the "good first issue" label for marking such issues, so keep an eye on those ;) (https://github.com/canonical/rockcraft/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+)

cjdcordeiro commented 2 years ago

fixtures are used across all unit tests