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

Remove unittest #2044

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

hulkoba
Copy link

@hulkoba hulkoba commented Aug 29, 2024

Hello 👋!

As part of the STF work for Conda, this PR introduces several improvements to our testing framework by transitioning from unittest to pytest and leveraging pytest-mock for mocking.

It is split up from #1975.

Thank you!

Checklist

  • Added a news entry

@hulkoba hulkoba requested a review from a team as a code owner August 29, 2024 07:43
@hulkoba
Copy link
Author

hulkoba commented Aug 29, 2024

Linting fails because of an unused var F841 Local variable git_mock is assigned to but never used
But when I remove the line(s), the tests fail.

@@ -46,7 +45,7 @@ def parameterize():
shutil.rmtree(tmp_dir)


class TestFeedstockIO(unittest.TestCase):
class TestFeedstockIO:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test executes the setup method before tests. If we simply remove the class inheritance here, I am not sure if that will happen or not given the code now. Can we convert the setup to a test fixture and the methods to functions?


if repo is not None:
blob = next(repo.index.iter_blobs(BlobFilter(filename2)))[1]
read_text = blob.data_stream[3].read().decode("utf-8")

self.assertEqual(write_text, read_text)
assert write_text == read_text

def tearDown(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same comment applies to teardown. This should be part of a test fixture IIUIC.

@@ -532,18 +532,18 @@ def test_v1_cbc_osx_hints(
assert any(lint.startswith(exp_lint) for lint in lints)


class TestLinter(unittest.TestCase):
class TestLinter:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The methods on this class should be converted to pure functions.

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.

2 participants