-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: align test suits #39
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Flags with carried forward coverage won't be shown. Click here to find out more.
|
8503893
to
ccf9f17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for streamlining unit tests. I left a few minor comments. Back to you @AlexTheWizardL .
tests/test_file_up_and_download.py
Outdated
@@ -6,13 +6,11 @@ | |||
|
|||
|
|||
def random_word(length: int) -> str: | |||
"""Generate a random word using lowercase letters.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this comment helpful and would leave it.
@@ -7,101 +7,83 @@ | |||
|
|||
|
|||
@pytest.fixture(scope="module") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any benefit of using a fixture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only lines of code are reduced since no need to define a class instance in every test suit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided on the meeting to remove fixture for this case
@@ -7,101 +7,83 @@ | |||
|
|||
|
|||
@pytest.fixture(scope="module") | |||
def cc_client() -> CachedCashCtrlClient: | |||
def cc_client(): | |||
return CachedCashCtrlClient() | |||
|
|||
|
|||
@pytest.fixture(scope="module") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any benefit of using a fixture?
tests/test_cached_accounts.py
Outdated
return CachedCashCtrlClient() | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def accounts() -> pd.DataFrame: | ||
def accounts(): | ||
"""Explicitly call the base class method to circumvent the cache.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a comment, not a docstring.
Applies to all test_cached_...
.
tests/test_cached_accounts.py
Outdated
return CachedCashCtrlClient() | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def accounts() -> pd.DataFrame: | ||
def accounts(): | ||
"""Explicitly call the base class method to circumvent the cache.""" | ||
cc_client = CachedCashCtrlClient() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this in line with the comment 'Explicitly call the base class method to circumvent the cache.'?
Also applies to test_cached_accounts.py
, test_cached_tax_rates.py
, test_cached_tax_rates.py
tests/test_list_directory.py
Outdated
def mock_directory(tmp_path: Path) -> Path: | ||
def mock_directory(tmp_path: Path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a return type hint for fixtures and other local helper functions helpful.
Let's discuss which is better
…tead, remove useless code snippets
6a393c9
to
05262a7
Compare
Merging. Thanks for the changes! |
This PR covers changes that align test suits to a common standard.
from:
to:
Example (this code is removed):