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

Tox is incompatible with projects using flit.ini #75

Closed
jquast opened this issue Feb 14, 2016 · 5 comments
Closed

Tox is incompatible with projects using flit.ini #75

jquast opened this issue Feb 14, 2016 · 5 comments

Comments

@jquast
Copy link

jquast commented Feb 14, 2016

This might duplicate #74, but there is a lot of information there, so I thought I'd express this issue here.

tox depends upon a setup.py file to manage. We can avoid processing setup.py, but this negates the purpose of the tool -- to install the software from within a container.

$ cat tox.ini
[testenv]
deps = pytest
commands = py.test --verbose {toxinidir}/tests

$ tox
Traceback (most recent call last):
  File "/usr/local/bin/tox", line 9, in <module>
    load_entry_point('tox==2.3.1', 'console_scripts', 'tox')()
  File "/Library/Python/2.7/site-packages/tox-2.3.1-py2.7.egg/tox/session.py", line 39, in main
    retcode = Session(config).runcommand()
  File "/Library/Python/2.7/site-packages/tox-2.3.1-py2.7.egg/tox/session.py", line 375, in runcommand
    return self.subcommand_test()
  File "/Library/Python/2.7/site-packages/tox-2.3.1-py2.7.egg/tox/session.py", line 520, in subcommand_test
    path = self.get_installpkg_path()
  File "/Library/Python/2.7/site-packages/tox-2.3.1-py2.7.egg/tox/session.py", line 496, in get_installpkg_path
    path = self._makesdist()
  File "/Library/Python/2.7/site-packages/tox-2.3.1-py2.7.egg/tox/session.py", line 390, in _makesdist
    raise tox.exception.MissingFile(setup)
tox.MissingFile: MissingFile: /Users/jquast/Code/ptyprocess/setup.py

We can modify tox.ini to ignore using setup.py,

[tox]
skipsdist=true

[testenv]
deps=pytest
commands = py.test --verbose {toxinidir}/tests

But not we're only creating a virtualenv to contain py.test and nothing more. We are using tests from, and testing against the source folder. We aim to test the installed version of our software to verify correct packaging (especially file inclusions/exclusions).

Try 3, to explicitly install dependency flit so that we can install our package for testing:

[tox]
skipsdist=true

[testenv]
deps=pytest
     flit
commands = flit
           flit -f {toxinidir}/flit.ini install
           py.test --verbose {toxinidir}/tests

This fails because flit is only made available as a python 3 wheel and without source distribution, so it fails to install for python2.7 testing. I'm not sure where to go from here.

@takluyver
Copy link
Member

Dealing with the ptyprocess specific question over there, answering more generally for flit here:

By and large, I prefer to test pure Python code from the source directory rather than installing it. Flit facilitates this by eliminating the biggest source of differences between the source and installation - package_data and MANIFEST.in. The installed package should be exactly the same as the source package, just at a different path in the filesystem.

If you do need to install the package, the intention for the next version of flit (see #72) is that flit should be installed outside your testing virtualenv, and be pointed to install the package inside it. The idea there is that flit is more a command line tool that happens to be implemented in Python, not something you should need to install in your testing environment. As you found, flit itself cannot be installed with Python 2, although there is a minimal installer shim that can be used in a pinch.

#74 summarises the various options for integrating with systems that expect sdists or setup.py files. I am hopeful that we can hash out a new source tree standard that doesn't rely on setup.py files - see pypa/interoperability-peps#54.

@jquast
Copy link
Author

jquast commented Feb 14, 2016

Thanks, I appreciate the explanation.

If you could envision a world where tox and flit get along, could this be a code change in tox, to conditionally support flit, say a useflit=true option for tox.ini, this would change the default setup.py-based sdist packaging to use flit by the command-line interface?

@jquast
Copy link
Author

jquast commented Feb 14, 2016

@takluyver
Copy link
Member

Thanks! Yes, I think it would be technically possible to teach tox about flit specifically, but I'd prefer to try to push through that build system abstraction proposal, and then teach tox about the new standard for source distributions.

@jquast jquast closed this as completed Feb 14, 2016
@merwok
Copy link
Contributor

merwok commented Mar 29, 2017

FYI, you can define skip_install = true in tox.ini (section testenv) and do what you want in the commands settings to install the package if you want to.

*edit* Built-in support is here: tox-dev/tox#954

*edit* Something's missing, pip inside tox still needs an sdist with setup.py

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

No branches or pull requests

3 participants