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

Moar tests #100

Merged
merged 35 commits into from
Dec 31, 2014
Merged

Moar tests #100

merged 35 commits into from
Dec 31, 2014

Conversation

SEJeff
Copy link
Member

@SEJeff SEJeff commented Dec 27, 2014

So I started working on py3k support, but since I was re-reminded of @brutasse's #70, I rebased and deleted those commits. Additionally, due to #98, which I also did, I rebase deleted those commits as @amosshapira took care of that first :)

Anyways, this brings up the total test coverage of whisper.py up from 67 --> 88%. I'll be slowly continuing to update this, but it can be merged now.

Also move the caught exceptions around os.unlink() to be more explicit
If you set whisper.CACHE_HEADERS to True and run whisper.info to
cache the headers, the cached version will always be used even if
whisper.CACHE_HEADERS is still used.
Once the coverage is a bit more up to spec, I can actually refactor
some of these bits and still sleep at night.
This was removed when I rebase removed my py3k support changes
as @brutasse opened graphite-project#70 long before I had this all ready to merge.
This ups the test coverage to 86% for whisper.py
@SEJeff SEJeff mentioned this pull request Dec 27, 2014
This lets us track the improvements in test coverage this branch
brings see this website for more information:
    https://coveralls.io/r/graphite-project/whisper
@coveralls
Copy link

Coverage Status

Coverage increased (+19.65%) when pulling fcd3a98 on SEJeff:moar-tests into 6a5d773 on graphite-project:master.

@SEJeff
Copy link
Member Author

SEJeff commented Dec 28, 2014

I also setup the bits for coveralls.io to measure our coverage for whisper. We can use whisper as a test bed and if people like it, we can enable it for the other repos:

cc: @graphite-project/committers

info = __headerCache.get(fh.name)
if info:
return info
if CACHE_HEADERS:
Copy link
Member Author

Choose a reason for hiding this comment

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

FYI the code was buggy before. If you set CACHE_HEADERS=True, ran whisper.info() on a whisper file, set CACHE_HEADERS=False, and then used whisper.resize() or something to change the archive in the same python process (like a test that re-uses the same archive name over multiple tests), it will always and only use the cached version.

That behavior is blatantly broken as you shouldn't use the cache if CACHE_HEADERS is False. This was to prevent it from happening again.

This is for setAggregationMethod
Unlike unittest.TestCase.assertRaises, this context manager will
also validate the contents of the raised exception and not just
the type.

There are places in the whisper codebase where an InvalidConfiguration
or CorruptWhisperFile exception is raised with different values. This
ensures we are getting the expected exceptions when we think we are.
This ensures that when we are testing for an exception, it is in the
code path we think it is hitting.
@coveralls
Copy link

Coverage Status

Coverage increased (+21.63%) when pulling 0eac661 on SEJeff:moar-tests into 6a5d773 on graphite-project:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+21.63%) when pulling 56f8ab8 on SEJeff:moar-tests into 6a5d773 on graphite-project:master.

@obfuscurity
Copy link
Member

@SEJeff is this still ok to merge or should we wait on more?

@SEJeff
Copy link
Member Author

SEJeff commented Dec 31, 2014

Good to go for now sir! I was waiting for 1 other person to ack it and preferably merge it

obfuscurity added a commit that referenced this pull request Dec 31, 2014
@obfuscurity obfuscurity merged commit 7c49962 into graphite-project:master Dec 31, 2014
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