-
Notifications
You must be signed in to change notification settings - Fork 14
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
Running scripts that have not been installed #34
Comments
Hi Brecht, Unfortunately at the moment the running of scripts that are not installed is not supported. It seems in principle possible to implement it as you describe (parse or execute setup.py, understand where to find the scripts, load and invoke them) but it's also quite a bit of work and would be hard to make it reliable (because setup.py can be doing all kinds of things and we'll have to support/understand them). If your use case for running the tests outside of Tox is similar to mine (quickly run one test file during development) then perhaps my solution will work for you. I install the package I'm working on into one of the Tox virtualenvs in development mode ( Hopefully this helps, |
Thanks for you reply, Vasily. Please consider mentioning this limitation in the README, along with your suggestion on how to work around this issue. In case anyone wants to have a go at implementing this, here's a start: from distutils.core import run_setup
distribution = run_setup('path/to/setup.py', stop_after='init')
distribution.entry_points['console_scripts'] |
Hi Brecht, Thanks for the suggestions. I have documented the testing during development use case and added a reference to this ticket, in case someone would like to take a shot at it (unfortunately I'm not able to prioritize this at the moment). I will rename the ticket to look like a new feature instead of a question. Feel free to rename to the original name if you prefer that or let me know if you'd like to change anything else. Cheers, |
Hello, I am kind of new to python and I could not exactly follow the thread. Do you know if there are limitations of running it multithreaded? @kvas-it Could we with @brechtm somehow contribute to make it easier to test uninstalled scripts, because I think that this is the beauty of this tool? Testing uninstalled scripts without the hassle of installing them. I would use subprocess if the script was installed and was not mine (not from the same package that I am testing). |
Hi, Mihail!
I think it should be possible to use the approach from @brechtm's comment. Based on some research into this direction that I've done, I would probably do something like this:
Since Bonus: handle If this sounds like too much, let me know, I might have time to work on this in the coming weeks. Cheers, |
From |
I think it's too much effort to support something non-standard. This could technically be done but the end result would have drawbacks similar to a development install, and at that point it's hard to justify why a development install shouldn't be performed instead of trying to extract the entry points from the setup metadata. For running pytest locally use I think any solution which depends on |
Yeah, I agree with @HexDecimal. Now with greater proliferation of build tools supporting testing while not installed for all kinds of packages is a lot of work. @brechtm: would you be ok with updating the documentation and closing this ticket or do you think there's something else to be done? |
I agree that it doesn't make sense to implement something that only works for I don't have the time to spare currently, sorry. Please go ahead and close this issue. |
Sorry for disturbing you with my bike-shedding. I'll close this for now since it doesn't make much sense for newer packagers. If someone insisted then I might try to get the console scripts from |
I can succesfully test my console scripts when running from a Tox environment. However, I would also like to run these tests outside when not using Tox. The readme is not clear about whether this is possible or not.
My project layout is as follows:
My setup.py:
When running pytests in a development environment, it is common to set
PYTHONPATH=src
. Is it possible to point pytest-console-scripts to setup.py somehow in this case so that it can find the console scripts?The text was updated successfully, but these errors were encountered: