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 test for CLI tool #170

Merged
merged 8 commits into from
Aug 26, 2024
Merged

Add test for CLI tool #170

merged 8 commits into from
Aug 26, 2024

Conversation

mhmohona
Copy link
Member

@mhmohona mhmohona commented Jul 10, 2024

Contributor checklist


Description

image

Related issue

  • #ISSUE_NUMBER

Copy link

github-actions bot commented Jul 10, 2024

Thank you for the pull request!

The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Data rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist

  • The commit messages for the remote branch should be checked to make sure the contributor's email is set up correctly so that they receive credit for their contribution

    • The contributor's name and icon in remote commits should be the same as what appears in the PR
    • If there's a mismatch, the contributor needs to make sure that the email they use for GitHub matches what they have for git config user.email in their local Scribe-Data repo
  • The linting and formatting workflow within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@wkyoshida
Copy link
Member

Hey, @mhmohona! 👋

I noticed the tests appear to be failing when running in the CI. Did notice also though that the screenshot in the PR description shows the tests do run OK when pytest is ran within src/scribe_data/cli. Does running pytest in the root of the project still run OK too?

@mhmohona
Copy link
Member Author

mhmohona commented Jul 11, 2024

Hey, @mhmohona! 👋

I noticed the tests appear to be failing when running in the CI. Did notice also though that the screenshot in the PR description shows the tests do run OK when pytest is ran within src/scribe_data/cli. Does running pytest in the root of the project still run OK too?

Thank you @wkyoshida for looking into this. The thing is this tests passes when everything is in one place. I mean all the files, total.py, list.py, query.py is in one branch, then these tests works without any error. Both unittest and Pytest passes. I tried it locally and it passes as you can see in screenshot.

@andrewtavis andrewtavis self-requested a review August 11, 2024 13:23
@andrewtavis
Copy link
Member

Ok so the tests are passing, but then a question I have is when are the tests that we have written here ran? Is it possible to move the tests for the CLI into the Scribe-Data/tests directory such that they're ran as a part of the pytest suite?

@andrewtavis
Copy link
Member

Would you be able to make this change, @mhmohona? Let us know if you have any questions!

@mhmohona
Copy link
Member Author

Ok so the tests are passing, but then a question I have is when are the tests that we have written here ran? Is it possible to move the tests for the CLI into the Scribe-Data/tests directory such that they're ran as a part of the pytest suite?

I will work on it.

@andrewtavis
Copy link
Member

@mhmohona, just updated both your branches as there have been tons of changes recently. Let us know if there's anything we can do to support with these!

@mhmohona
Copy link
Member Author

mhmohona commented Aug 26, 2024

@andrewtavis @wkyoshida this PR is up for review now.


def test_list_data_types_no_data_types(self):
with self.assertRaises(ValueError):
list_data_types("Klingon")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe one day could be a language 😅 Wikidata does have data for it 😇 But fine for now :)

Copy link
Member

@andrewtavis andrewtavis 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 writing all of these tests, @mhmohona! Great that the Scribe community is focussing so much more on tests these days 😊

@andrewtavis andrewtavis merged commit 7e3a6f4 into scribe-org:main Aug 26, 2024
3 checks passed
call(),
call('Available data types: All languages'),
call('-----------------------------------'),
call('emoji-keywords'),
Copy link
Member

Choose a reason for hiding this comment

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

Hmm - just noting something down here that came to mind just now..

Concerning the discussion we had on providing package options without PyICU and consequently the emoji functionality - omitting emoji-keywords as an available data type in the command output will probably be a good idea. With that, testing that the appropriate options are getting outputted given whether with/without PyICU might be good too.

...but! That's for when we get there 😉

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.

3 participants