Skip to content

Add testing for methods defined in GitGud object #314

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

Closed
wants to merge 1 commit into from

Conversation

sahansk2
Copy link
Contributor

@sahansk2 sahansk2 commented Sep 8, 2020

Fixes #197

@benthayer Could you verify for which methods you would like tests?

Copy link
Owner

@benthayer benthayer left a comment

Choose a reason for hiding this comment

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

I was a bit quick with the comments here to try and be expedient. I think everything is covered. Let me know if you need clarification.

Also, at this point, I think creating levels is the priority, not necessarily the tests, so don't feel like you're obligated to write all these tests

pass
def test_handle_commit():
pass
def test_handle_contrib():
Copy link
Owner

Choose a reason for hiding this comment

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

No test

pass
def test_handle_contrib():
pass
def test_handle_debug():
Copy link
Owner

Choose a reason for hiding this comment

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

No test


from gitgud.__main__ import GitGud

def test_assert_initialized():
Copy link
Owner

Choose a reason for hiding this comment

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

Test in git gud repo, git repo, empty directory

pass
def test_handle_test():
pass
def test_is_initialized():
Copy link
Owner

Choose a reason for hiding this comment

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

Test with assert_initilized


def test_assert_initialized():
pass
def test_handle_commit():
Copy link
Owner

Choose a reason for hiding this comment

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

Since we might be removing this, no test yet unless you want to

pass
def test_handle_reset():
pass
def test_handle_show():
Copy link
Owner

Choose a reason for hiding this comment

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

Test with show-tree

pass
def test_handle_skills():
pass
def test_handle_solution():
Copy link
Owner

Choose a reason for hiding this comment

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

Same tests as other user facing commands, but obviously this one, you'll need to test the --confirm flag

pass
def test_handle_status():
pass
def test_handle_test():
Copy link
Owner

Choose a reason for hiding this comment

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

Load up a level and make sure that it it doesn't fail either when the level has been completed or when it hasn't

Also make sure it doesn't fail if we're not in a git dir

pass
def test_load_level():
pass
def test_parse():
Copy link
Owner

Choose a reason for hiding this comment

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

Test git gud without any subcommands in git dir and non-git dir

pass
def test_is_initialized():
pass
def test_load_level():
Copy link
Owner

Choose a reason for hiding this comment

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

commits.csv should be modified after this func is run, and the level file should correspond to the one loaded.

There should be a test for this in test_operator.py if there isn't one already

@benthayer
Copy link
Owner

It might (probably will) make sense to split this up into multiple PRs

@sahansk2
Copy link
Contributor Author

sahansk2 commented Sep 9, 2020

If you'd like multiple PRs, would you also like multiple issues for this? E.g. "Test user methods using webbrowser", "Test user methods related to loading", "Test assert initialized methods", etc?

@benthayer
Copy link
Owner

Yes, I think that makes sense. Obviously, there would be many issues, and writing the issues might take as long as it takes to simply write the test, so do what you feel is right. There should either be a pull request or an issue for each test

@sahansk2
Copy link
Contributor Author

sahansk2 commented Sep 9, 2020

What we could do is make a new "meta-issue", similar to what #238 is. Each checkbox could be a method in the GitGud object.

Going off of this, we could maintain another branch user_tests on this repository, and people open up testing PRs to merge to user_tests. Once all the tests are in and everything looks set, we merge user_tests into master. This is similar to what the intro branch (or the add branch, I forget) was like a while back.

I'm not sure what's best, so it's your call. As an aside, should this PR be closed?

@benthayer
Copy link
Owner

I think we can open a meta-issue (along with other issues)

I don't think we need to make a separate branch for the tests, I think we can merge them right into master when they are done.

This PR can stay open until there exists other issues/PRs that make use of the useful comments that are here

@benthayer benthayer self-assigned this Sep 15, 2020
@benthayer
Copy link
Owner

Stale/closing

@benthayer benthayer closed this Nov 20, 2020
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.

Use error codes to test user-facing commands
2 participants