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

Add basic cli tests for date/time options and fix build warnings #316

Merged
merged 3 commits into from
Nov 26, 2019

Conversation

davidag
Copy link
Contributor

@davidag davidag commented Sep 20, 2019

Inspired by tests in #282 (which is sadly stalled), here are some basic tests for testing date/time correctness for all Watson commands which do have time-related options.

Besides that, a mock deprecation warning has been fixed by using mocker. It was a trivial replace, that's why I've decided to add it to this PR, although in a separate commit.

The message in the builds was as follows:

DeprecationWarning: "mock" fixture has been deprecated, use "mocker" instead
    '"mock" fixture has been deprecated, use "mocker" instead', DeprecationWarning

-- Docs: https://docs.pytest.org/en/latest/warnings.html

A pytest warning related to the datafiles plugin has also been fixed. The message was as follows:

.tox/py36/lib/python3.6/site-packages/_pytest/mark/structures.py:324

/home/travis/build/TailorDev/Watson/.tox/py36/lib/python3.6/site-packages/_pytest
/mark/structures.py:324: PytestUnknownMarkWarning: Unknown pytest.mark.datafiles - 
    is this a typo?  You can register custom marks to avoid this warning -
    for details, see https://docs.pytest.org/en/latest/mark.html

    PytestUnknownMarkWarning,

This PR also includes changes from PR #315 as they are necessary to run green. When that PR is merged, I will rebase and leave only the other commits, if that's OK for you ☺️

Update 2019-09-30: This PR is now ready to be code-reviewed / merged.

@davidag davidag changed the title Add basic cli tests for date/time options and fix mock deprecation warning Add basic cli tests for date/time options and fix build warnings Sep 22, 2019
@davidag
Copy link
Contributor Author

davidag commented Sep 30, 2019

@jmaupetit Thanks to you merging #315 I've been able to remove the unneeded commit in this PR, and it should be ready to be code-reviewed / merged.

pytest.ini Show resolved Hide resolved
Copy link
Collaborator

@k4nar k4nar left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to do that!

The way you structured the tests is a bit unusual, at least to my eyes. Are you following a known pattern, or is it just something you came up with? :)

No judgment involved, I would be happy to refactor it in what I think would be a more conventional way if you'd like.

@davidag
Copy link
Contributor Author

davidag commented Sep 30, 2019

Thanks for taking the time to do that!

No problem!

The way you structured the tests is a bit unusual, at least to my eyes. Are you following a known pattern, or is it just something you came up with? :)

I'm not sure I understand what you mean 😅 Is the hierarchy what looks unusual to you? I remember I programmed this trying to refactor code after adding each test in order to avoid duplicate code.

In any case, there's no pattern here, just what I came up with ☺️

No judgment involved, I would be happy to refactor it in what I think would be a more conventional way if you'd like.

Please, go ahead! I'm sure the tests will be more consistent and thorough if you could give me a hand here 👍

@davidag
Copy link
Contributor Author

davidag commented Oct 7, 2019

@k4nar If it's of any help, I wouldn't mind refactoring the tests into a more usual structure if you pointed me to some example/reference code.

Thank you for your time and excuse my insistence!

Pytest does not recognize the 'datafiles' mark provided by the
corresponding plugin. The solution is to register this mark as a custom
one in pytest.ini, as suggested by the warning message itself.
@davidag
Copy link
Contributor Author

davidag commented Nov 25, 2019

@k4nar: I've removed inheritance to make the tests more "pytesty" 🤞 ☺️

Copy link
Collaborator

@k4nar k4nar left a comment

Choose a reason for hiding this comment

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

Great work thanks! Sorry for never taking the time to go back to you :( .

@jmaupetit jmaupetit merged commit 224bf44 into jazzband:master Nov 26, 2019
@davidag davidag deleted the add-cli-tests branch November 26, 2019 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants