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

Improve test_link_arg_* tests #261

Merged
merged 1 commit into from Jan 18, 2019

Conversation

hemberger
Copy link
Contributor

The test_link_arg_regex test was accidentally passing. By adding
another link to the test html, we can see that it was selecting the
first link instead of the link that matched the supplied regex.
This new version of the test fails, but it will be fixed by #256.

Also added a case for no arguments and reduced code duplication
by changing it to a parameterized test.

I'm not sure what way would be best to merge this in, since it should
come before #256 (to demonstrate the existing failure), but we probably
don't want the master branch to be failing for an extended period of time.
Any thoughts?

@moy
Copy link
Collaborator

moy commented Jan 17, 2019

Even if it doesn't happen for a long period of time, I prefer to avoid temporary breakage. This makes history bisectable and IMHO more readable.

You can mark the test as known failure with @pytest.mark.xfail in this commit, and the removal of this mark in the next commit documents the fact that it fixes the bug.

The `test_link_arg_regex` test was accidentally passing. By adding
another link to the test html, we can see that it was selecting the
first link instead of the link that matched the supplied regex.
This new version of the test fails, but it will be fixed by MechanicalSoup#256.

Also added a case for no arguments and reduced code duplication
by changing it to a parameterized test.
@hemberger
Copy link
Contributor Author

Aha, I had forgotten about pytest.mark.xfail. Thanks for the suggestion! Should be fixed now.

@hemberger hemberger merged commit 3c7a4fb into MechanicalSoup:master Jan 18, 2019
@hemberger hemberger deleted the fix-link-tests branch January 18, 2019 22:11
tiboroche pushed a commit to tiboroche/MechanicalSoup that referenced this pull request Mar 1, 2019
If you called the function with url_regex='/something' and not the
link argument, it would set the url_regex to None, and thus the result
would be impredictable.

This is tested by the test added by MechanicalSoup#261
tiboroche pushed a commit to tiboroche/MechanicalSoup that referenced this pull request Mar 1, 2019
If you called the function with url_regex='/something' and not the
link argument, it would set the url_regex to None, and thus the result
would be impredictable.

This is tested by the test added by MechanicalSoup#261
moy pushed a commit that referenced this pull request Mar 1, 2019
If you called the function with url_regex='/something' and not the
link argument, it would set the url_regex to None, and thus the result
would be impredictable.

This is tested by the test added by #261
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.

None yet

2 participants