You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on the script for testing pull requests I noticed a python 3 syntax error in line 153 networkx/external/decorator/_decorator.py. It is strange because the error is not raised during the tests (thus they pass) but during the setup of the virtualenv. To reproduce the error run the test_pr.py script from #752 with python3.2 installed. Notice that despite the error tests are actually run with python3.2
File "/home/jtorrents/.nx_pr_tests/venv-python3.2/lib/python3.2/site-packages/networkx/external/decorator/_decorator.py", line 153
exec code in evaldict
^
SyntaxError: invalid syntax
There are two versions of the decorator code _dectorator.py (Python2.x) and _decorator3.py (Python3.x) with a dispatch from init.py in that directory. So _decorator.py should never get run by Python3.
I guess the virtualenv setup is calling that somehow?
I see, I didn't look closely because the test_pr.py script is working fine despite this error. I'll try to see why and how is virtualenv calling the 2.x version of _decorator.py. I'm closing this issue.
Depending on how your setup.py works, it might try to byte-compile all the Python files it installs, which will pick up on invalid syntax. If that's what you're seeing, it's most likely harmless.
You are right. All files are byte-compiled at install time, so the python2 only files throw Syntax Error when using python3.2. This doesn't prevent a correct installation, so it seems harmless. The commit above pipes STDERR to STDOUT when installing NetworkX, so the error message is written to the log and doesn't show up in the screen while running test_pr.py.
Thanks for the feedback, and for test_pr.py and friends!
You're welcome! At some point I might spin test_pr out into a separate project that can be used for multiple projects, so it's good to see someone else using it.
Thanks - one of the reasons I haven't spun it out into a separate project
is that I worry it would rapidly gain complexity to handle the requirements
of different projects.
I'm thinking of insisting projects use a standard way to run tests,
something like: we will install your project in a virtualenv, then call
"import Foo; Foo.test()". We already have IPython.test(), although test_pr
doesn't use it at present. Then all the configuration it needs for a
project should be:
I see you're already doing something similar in your variant of the script,
but specifying arguments to .test(). Would it be acceptable for .test() to
be called with the default arguments if test_pr became a generic thing?
Thanks - one of the reasons I haven't spun it out into a separate project
is that I worry it would rapidly gain complexity to handle the requirements
of different projects.
I'm thinking of insisting projects use a standard way to run tests,
something like: we will install your project in a virtualenv, then call
"import Foo; Foo.test()". We already have IPython.test(), although test_pr
doesn't use it at present. Then all the configuration it needs for a
project should be:
I see you're already doing something similar in your variant of the script,
but specifying arguments to .test(). Would it be acceptable for .test() to
be called with the default arguments if test_pr became a generic thing?
Thanks - one of the reasons I haven't spun it out into a separate project
is that I worry it would rapidly gain complexity to handle the requirements
of different projects.
I'm thinking of insisting projects use a standard way to run tests,
something like: we will install your project in a virtualenv, then call
"import Foo; Foo.test()". We already have IPython.test(), although test_pr
doesn't use it at present. Then all the configuration it needs for a
project should be:
I see you're already doing something similar in your variant of the script,
but specifying arguments to .test(). Would it be acceptable for .test() to
be called with the default arguments if test_pr became a generic thing?
That seems reasonable and a good approach. As Aric says we could make
the necessary changes for calling nx,test() with the default
arguments.
Activity
hagberg commentedon Aug 10, 2012
There are two versions of the decorator code _dectorator.py (Python2.x) and _decorator3.py (Python3.x) with a dispatch from init.py in that directory. So _decorator.py should never get run by Python3.
I guess the virtualenv setup is calling that somehow?
jtorrents commentedon Aug 10, 2012
I see, I didn't look closely because the test_pr.py script is working fine despite this error. I'll try to see why and how is virtualenv calling the 2.x version of _decorator.py. I'm closing this issue.
takluyver commentedon Aug 10, 2012
Depending on how your
setup.pyworks, it might try to byte-compile all the Python files it installs, which will pick up on invalid syntax. If that's what you're seeing, it's most likely harmless.pipe STDERR to STDOUT when installing NX so its output is also writte…
jtorrents commentedon Aug 12, 2012
Hi Thomas,
You are right. All files are byte-compiled at install time, so the python2 only files throw Syntax Error when using python3.2. This doesn't prevent a correct installation, so it seems harmless. The commit above pipes
STDERRtoSTDOUTwhen installing NetworkX, so the error message is written to the log and doesn't show up in the screen while runningtest_pr.py.Thanks for the feedback, and for
test_pr.pyand friends!takluyver commentedon Aug 12, 2012
You're welcome! At some point I might spin test_pr out into a separate project that can be used for multiple projects, so it's good to see someone else using it.
jtorrents commentedon Aug 12, 2012
I like
test_pra lot, it is small, simple and easy to modify. If you create a separate project I'll be one of your first users ;)Salut!
takluyver commentedon Aug 12, 2012
Thanks - one of the reasons I haven't spun it out into a separate project
is that I worry it would rapidly gain complexity to handle the requirements
of different projects.
I'm thinking of insisting projects use a standard way to run tests,
something like: we will install your project in a virtualenv, then call
"import Foo; Foo.test()". We already have IPython.test(), although test_pr
doesn't use it at present. Then all the configuration it needs for a
project should be:
[ipython]
github_repo = ipython/ipython
package_name = IPython
I see you're already doing something similar in your variant of the script,
but specifying arguments to .test(). Would it be acceptable for .test() to
be called with the default arguments if test_pr became a generic thing?
hagberg commentedon Aug 12, 2012
On Sun, Aug 12, 2012 at 11:47 AM, Thomas Kluyver
[email protected]:
Sure that would be fine.
Aric
jtorrents commentedon Aug 12, 2012
2012/8/12 Thomas Kluyver [email protected]
That seems reasonable and a good approach. As Aric says we could make
the necessary changes for calling
nx,test()with the defaultarguments.
Salut!