Skip to content

Conversation

@jayvdb
Copy link
Contributor

@jayvdb jayvdb commented Sep 23, 2015

Fixes issue #164

Copy link
Member

Choose a reason for hiding this comment

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

Rather than doing this four-line check, I'd suggest doing this at the top of the file:

try:
    import cryptography
except ImportError:
    cryptography = None

and then using the skipUnless() decorator on tests that require the cryptography module:

@unittest.skipUnless(cryptography, "cryptography module is required")
def test_signature_methods(self, generate_nonce, generate_timestamp):
    # ...

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've moved the import at the top.
Unfortunately skipUnless isn't available on Python 2.6's unittest, and using monkey patching for that is going too far IMO. We could switch to using unittest2 on Python 2.6.

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 25, 2015

Travis build with revised patch and the #168 patch: https://travis-ci.org/jayvdb/requests-oauthlib/builds/82236300

Copy link
Member

Choose a reason for hiding this comment

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

Why are we bothering to print anything here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So that the unittest output shows something useful. i.e.
https://travis-ci.org/jayvdb/requests-oauthlib/jobs/82236301#L176

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to add unittest2 support so that this workaround is needed?

Copy link
Member

Choose a reason for hiding this comment

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

That might be better, yeah.

Lukasa added a commit that referenced this pull request Dec 14, 2015
Skip rsa tests when dependencies not met
@Lukasa Lukasa merged commit 14e22f8 into requests:master Dec 14, 2015
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