Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Fixes #11: Issue with distutils.fancy_getopt and unicode literals. #12

Closed
wants to merge 2 commits into from

Conversation

awood
Copy link
Contributor

@awood awood commented Jul 5, 2016

@adamchainz
Copy link
Owner

adamchainz commented Jul 5, 2016

Any way of adding a test?

@awood
Copy link
Contributor Author

awood commented Jul 5, 2016

@adamchainz that test works as long as nose-randomly isn't already installed in site-packages. If you already have it installed (like I did at one point), then the from nose_randomly import RandomlyPlugin at the top of the test_basic module is going to import the one from site-packages instead of the local nose_randomly module. I'm not sure what the best way to handle that is. Some sort of mangling of sys.path or the like? Anyway, I wanted to get your opinion on the matter before embarking on that endeavor.

Anyhow, you can see the test pass and then make sure it fails "correctly" with this patch:

diff --git a/nose_randomly/plugin.py b/nose_randomly/plugin.py
index 7e6db31..7e69ee7 100644
--- a/nose_randomly/plugin.py
+++ b/nose_randomly/plugin.py
@@ -30,7 +30,7 @@ else:


 class RandomlyPlugin(Plugin):
-    name = str('randomly')
+    name = 'randomly'

     def options(self, parser, env):
         """Register commandline options.

@awood
Copy link
Contributor Author

awood commented Jul 5, 2016

I'm thinking something like http://stackoverflow.com/a/1848740/6124862 where nose_randomly is nuked from sys.modules, os.curdir is added to the front of sys.path, and then nose_randomly is imported.

@adamchainz
Copy link
Owner

I'm not keen on sys.path hacking or anything like that really. Btw it's only running under tox that's authoritative for tests, any other way of invoking them I'm not so fussed about. Since tox installs the package I think you could make it work by making tox chdir before running the tests so it can't pick up the local version.

@awood
Copy link
Contributor Author

awood commented Jul 6, 2016

Okay, if tox is the authoritative source, then I won't worry about it. Running with tox does the right thing and doesn't pick up the module under site-packages.

Let me know if there's anything else you'd like me to add.

@awood
Copy link
Contributor Author

awood commented Jul 6, 2016

@adamchainz Also, I saw on your blog that you use Jekyll. I'm going to take this opportunity to self-promote Hawkins which adds LiveReload into Jekyll.

@adamchainz
Copy link
Owner

Thx, looks useful!

@adamchainz adamchainz closed this in d9dbeb2 Jul 6, 2016
@adamchainz
Copy link
Owner

Merged, and released on PyPI as 1.2.2: https://pypi.python.org/pypi/nose-randomly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants