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

Issue #1201 Converted test_nocasedict.py from unittest to pytest and changed test_function decorator #1237

Merged
merged 3 commits into from May 2, 2018

Conversation

andy-maier
Copy link
Contributor

@andy-maier andy-maier commented Apr 25, 2018

For details, see the commit messages (two commits).
Ready for review and merge.

@andy-maier andy-maier self-assigned this Apr 25, 2018
@andy-maier andy-maier added this to the 0.13.0 milestone Apr 25, 2018
@coveralls
Copy link

coveralls commented Apr 25, 2018

Coverage Status

Coverage remained the same at 82.665% when pulling dbdaeac on andy/#1201-nocasedict into 14dad55 on master.

@andy-maier andy-maier force-pushed the andy/#1201-nocasedict branch 2 times, most recently from 291e581 to 67366ef Compare April 28, 2018 23:46
Details:

- Migrated all test cases in test_nocasedict.py from unittest to
  py.test.

- Expanded the test cases to be quite complete.

- In the (non-published) docstring of NocaseDict.update(), added
  information about the order of updates. This is relevant, now that
  NocaseDict preserves order. This is for internal clarity, as the
  NocaseDict description is not published.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
Details:

The current checking in the pytest_extensions.test_function decorator
verified that the warning has been issued exactly once. In some cases
(e.g. deprecated ordering comparisons for NocaseDict), the same
warning message and location is issued more than once (because the
NocaseDict ordering operators delegate to each other). The resulting
warning in the Pythn warning system shows only one warning, because
it merges warnings with the same type, message and location.
However, pytest captures the warnings before that merge and thus
shows more than one warning. This change relaxes the test for
exactly one warning to verify that one or more warnings have been issued
(of the specified type).

An additional difficulty was that when a testcase specifies both an
exception type and a warning type, this is really a bit overspecified,
because the warning could have been issued before the exception
was raised, or not. In theory, one could require that the testcases
have this knowledge, but again it seems a bit overspecified.
This change therefore removes the check for warnings, when an exception
has also been specified in the test case.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
@andy-maier andy-maier changed the title [WIP] Issue #1201 Converted test_nocasedict.py from unittest to pytest Issue #1201 Converted test_nocasedict.py from unittest to pytest Apr 29, 2018
@andy-maier andy-maier changed the title Issue #1201 Converted test_nocasedict.py from unittest to pytest Issue #1201 Converted test_nocasedict.py from unittest to pytest and changed test_function decorator Apr 29, 2018
Update the dictionary from key/value pairs. If an item for a key
exists in the dictionary, its value is updated. If an item for a key
does not exist, it is added to the dictionary at the end.
The provided keys and values are not copied.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sentence takes some thinking. We mean that the values from the dictionary are used without copying them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DONE.
Changed the sentence to: "The provided keys and values are stored in the dictionary without being copied."


Each positional argument can be:

* an object with a method `items()` that returns an
:term:`py:iterable` of tuples containing key and value.
A NocaseDict or other dict object would match that requirement.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't understand this sentence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to give a hint what this kind of positional argument is used for, but I guess it is not necessary. Removed the sentence, and also the similar sentence in the next item.
DONE.


* an object without such a method, that is an :term:`py:iterable` of
tuples containing key and value.
A list of tuples (key,value) would match that requirement.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. Not sure what you are trying to say.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See previous comment.

Copy link
Collaborator

@KSchopmeyer KSchopmeyer left a comment

Choose a reason for hiding this comment

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

Couple of editorial comments. Otherwise OK

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
@andy-maier
Copy link
Contributor Author

The new commit addresses all review comments.

@andy-maier andy-maier merged commit a62b13e into master May 2, 2018
@andy-maier andy-maier deleted the andy/#1201-nocasedict branch May 2, 2018 06:19
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

3 participants