Repository: tox-dev/tox
Pull request #753 (2018-01-27 23:07:09)

Skip alwayscopy tests for SuSE
This is a fix to issue #752.
Now `tox` succeeds (with python versions: py27, py34, py36).
*a priori* the i686 arch should be able to run, so skip `test_alwayscopy`  only for the x86-64 arch.


codecov[bot]: # [Codecov](https://codecov.io/gh/tox-dev/tox/pull/753?src=pr&el=h1) Report
> Merging [#753](https://codecov.io/gh/tox-dev/tox/pull/753?src=pr&el=desc) into [master](https://codecov.io/gh/tox-dev/tox/commit/68546bc7ef75a93e847c3056be808926a89aeb1f?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/tox-dev/tox/pull/753/graphs/tree.svg?width=650&height=150&src=pr&token=DYodAwDCZ5)](https://codecov.io/gh/tox-dev/tox/pull/753?src=pr&el=tree)

```diff
@@          Coverage Diff           @@
##           master    #753   +/-   ##
======================================
  Coverage    94.8%   94.8%           
======================================
  Files          11      11           
  Lines        2386    2386           
======================================
  Hits         2262    2262           
  Misses        124     124
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/tox-dev/tox/pull/753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/tox-dev/tox/pull/753?src=pr&el=footer). Last update [68546bc...7ab7646](https://codecov.io/gh/tox-dev/tox/pull/753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/changelog/755.bugfix.rst b/changelog/755.bugfix.rst
new file mode 100644
index 00000000..cbd625a6
--- /dev/null
+++ b/changelog/755.bugfix.rst
@@ -0,0 +1,1 @@
+fix #755 by reverting the ``cmdline`` import to the old location and changing the entry point instead - by @fschulze
diff --git a/setup.py b/setup.py
index 4d91d9f6..6fc8eb6a 100644
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,7 @@ def main():
         author='holger krekel',
         author_email='holger@merlinux.eu',
         packages=['tox'],
-        entry_points={'console_scripts': ['tox=tox:cmdline',
+        entry_points={'console_scripts': ['tox=tox.session:run_main',
                                           'tox-quickstart=tox._quickstart:main']},
         python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
         setup_requires=['setuptools_scm'],
diff --git a/tasks/pra.sh b/tasks/pra.sh
index 27b9944b..5d0a912c 100755
--- a/tasks/pra.sh
+++ b/tasks/pra.sh
@@ -45,17 +45,16 @@ prep () {
     towncrier --yes --version ${VERSION}
     pip install -U readme-renderer
     python setup.py check -r -s
-    _confirm "towncrier news rendered - move on?"
     git add CHANGELOG.rst
     git status
-    _confirm "changes to repository o.k.?"
+    _confirm "commit changelog and tag repo as ${VERSION}?"
     git commit -m "release preparation for ${VERSION}" || true
     git tag -s ${VERSION} -m "release tox ${VERSION}" || true
     rm dist/tox* || true
     python setup.py sdist bdist_wheel
     pip install -U dist/tox-${VERSION}.tar.gz
     tox --version
-    _confirm "version of package o.k.?"
+    _confirm "package and version o.k.?"
 }
 
 devpi_upload () {
@@ -66,8 +65,7 @@ devpi_upload () {
     echo "loggging in to devpi $1"
     devpi login $1
     devpi use https://m.devpi.net/$1/dev
-    echo "upload to devpi: $(ls dist/*)"
-    _confirm
+    _confirm "upload to devpi: $(ls dist/*)?"
     devpi upload dist/*
 }
 
@@ -77,8 +75,7 @@ devpi_cloud_test () {
         echo "needs $cloudTestPath"
         exit 1
     fi
-    echo "trigger devpi cloud tests for ${VERSION}?"
-    _confirm
+    _confirm "trigger devpi cloud tests for ${VERSION}?"
     cd ${cloudTestPath}
     dct trigger ${VERSION}
     xdg-open https://github.com/tox-dev/devpi-cloud-test-tox
@@ -88,7 +85,7 @@ devpi_cloud_test () {
 # TODO get devpi push to work again
 pypi_release () {
     PACKAGES=$(ls dist/*)
-    _confirm "upload to pypi: $PACKAGES"
+    _confirm "upload to pypi: $PACKAGES?"
     twine upload ${PACKAGES}
     git push upstream master
     git push upstream ${VERSION}
diff --git a/tox/__init__.py b/tox/__init__.py
index b7a16315..ba64b356 100644
--- a/tox/__init__.py
+++ b/tox/__init__.py
@@ -52,6 +52,6 @@ class exception:
             super(exception.MinVersionError, self).__init__(message)
 
 
-from .session import run_main as cmdline  # noqa
+from .session import main as cmdline  # noqa
 
 __all__ = ('hookspec', 'hookimpl', 'cmdline', 'exception', '__version__')


Test patch:
diff --git a/doc/example/pytest.rst b/doc/example/pytest.rst
index 521c741d..f871090d 100644
--- a/doc/example/pytest.rst
+++ b/doc/example/pytest.rst
@@ -95,6 +95,17 @@ importable from somewhere then your ``pytest`` invocation may end up
 importing the package from the checkout directory rather than the
 installed package.
 
+This issue may be characterised by pytest test-collection error messages, in python 3.x environments, that look like:
+
+.. code-block:: shell
+
+    import file mismatch:
+    imported module 'myproj.foo.tests.test_foo' has this __file__ attribute:
+      /home/myuser/repos/myproj/build/lib/myproj/foo/tests/test_foo.py
+    which is not the same as the test file we want to collect:
+      /home/myuser/repos/myproj/myproj/foo/tests/test_foo.py
+    HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
+
 There are a few ways to prevent this.
 
 With installed tests (the tests packages are known to ``setup.py``), a
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 1a38001b..3aebee11 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -2,7 +2,6 @@ import os
 import platform
 import re
 import subprocess
-import sys
 
 import py
 import pytest
@@ -635,7 +634,9 @@ def _alwayscopy_not_supported():
     # see: https://github.com/pypa/virtualenv/issues/565
     if hasattr(platform, 'linux_distribution'):
         _dist = platform.linux_distribution(full_distribution_name=False)
-        if _dist[0] == 'centos' and _dist[1][0] == '7':
+        (name, version, arch) = _dist
+        if any((name == 'centos' and version[0] == '7',
+                name == 'SuSE' and arch == 'x86_64')):
             return True
     return False
 
@@ -901,6 +902,5 @@ def test_tox_quickstart_script():
 
 
 def test_tox_cmdline(monkeypatch):
-    monkeypatch.setattr(sys, 'argv', ['caller_script', '--help'])
     with pytest.raises(SystemExit):
-        tox.cmdline()
+        tox.cmdline(['caller_script', '--help'])