codecov[bot]: # [Codecov](https://codecov.io/gh/tox-dev/tox/pull/756?src=pr&el=h1) Report
> Merging [#756](https://codecov.io/gh/tox-dev/tox/pull/756?src=pr&el=desc) into [master](https://codecov.io/gh/tox-dev/tox/commit/1d6ca4b5c488c9c8ba10d25cb79ca89c254cd786?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master     #756      +/-   ##
==========================================
- Coverage   94.88%   94.84%   -0.05%     
==========================================
  Files          11       11              
  Lines        2386     2386              
==========================================
- Hits         2264     2263       -1     
- Misses        122      123       +1
```


| [Impacted Files](https://codecov.io/gh/tox-dev/tox/pull/756?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [tox/\_\_init\_\_.py](https://codecov.io/gh/tox-dev/tox/pull/756/diff?src=pr&el=tree#diff-dG94L19faW5pdF9fLnB5) | `93.33% <100%> (ø)` | :arrow_up: |
| [tox/\_pytestplugin.py](https://codecov.io/gh/tox-dev/tox/pull/756/diff?src=pr&el=tree#diff-dG94L19weXRlc3RwbHVnaW4ucHk=) | `96% <0%> (-0.45%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/tox-dev/tox/pull/756?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/756?src=pr&el=footer). Last update [1d6ca4b...f758fb9](https://codecov.io/gh/tox-dev/tox/pull/756?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

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/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__')

tox 3.0.0rc1 breaks ``devpi test``
From https://github.com/tox-dev/tox/issues/728#issuecomment-361198048

The change of ``cmdline`` in f85b827c54de0f2531f69fc0c4883c8f4f3c8ecc broke ``devpi test``.

It's easy to fix on the devpi side, but I'm not sure if it will also break detox. I wasn't able to get detox tests running when I tried.

Maybe it would be better to revert ``cmdline`` back to ``test.session.main`` and change the entry point to tox.session.run_main instead.

cc @gaborbernat @obestwalter 
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..746032cb 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
@@ -901,6 +900,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'])

pip install -e .[testing]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-mock pytest-timeout pytest-xdist
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
iniconfig==2.1.0
packaging==24.2
platformdirs==4.3.7
pluggy==0.13.1
py==1.11.0
pytest==7.4.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-timeout==2.3.1
pytest-xdist==3.6.1
six==1.17.0
tomli==2.2.1
-e git+https://github.com/tox-dev/tox.git@1d6ca4b5c488c9c8ba10d25cb79ca89c254cd786#egg=tox
virtualenv==20.29.3

name: tox
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - distlib==0.3.9
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - filelock==3.18.0
      - iniconfig==2.1.0
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==0.13.1
      - py==1.11.0
      - pytest==7.4.4
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-timeout==2.3.1
      - pytest-xdist==3.6.1
      - six==1.17.0
      - tomli==2.2.1
      - tox==3.0.0rc1
      - virtualenv==20.29.3
prefix: /opt/conda/envs/tox

tests/test_z_cmdline.py::test_tox_cmdline
tests/test_z_cmdline.py::test_report_protocol tests/test_z_cmdline.py::test__resolve_pkg tests/test_z_cmdline.py::test_minversion tests/test_z_cmdline.py::test_notoxini_help_still_works tests/test_z_cmdline.py::test_envdir_equals_toxini_errors_out tests/test_z_cmdline.py::test_venv_special_chars_issue252 tests/test_z_cmdline.py::test_unknown_environment tests/test_z_cmdline.py::test_separate_sdist_no_sdistfile
tests/test_z_cmdline.py::test__resolve_pkg_doubledash tests/test_z_cmdline.py::TestSession::test_make_sdist tests/test_z_cmdline.py::TestSession::test_make_sdist_distshare tests/test_z_cmdline.py::TestSession::test_log_pcall tests/test_z_cmdline.py::TestSession::test_summary_status tests/test_z_cmdline.py::TestSession::test_getvenv tests/test_z_cmdline.py::test_notoxini_help_ini_still_works tests/test_z_cmdline.py::test_run_custom_install_command_error tests/test_z_cmdline.py::test_unknown_interpreter_and_env tests/test_z_cmdline.py::test_unknown_interpreter tests/test_z_cmdline.py::test_skip_platform_mismatch tests/test_z_cmdline.py::test_skip_unknown_interpreter tests/test_z_cmdline.py::test_skip_unknown_interpreter_result_json tests/test_z_cmdline.py::test_unknown_dep tests/test_z_cmdline.py::test_skip_sdist tests/test_z_cmdline.py::test_minimal_setup_py_empty tests/test_z_cmdline.py::test_minimal_setup_py_comment_only tests/test_z_cmdline.py::test_minimal_setup_py_non_functional tests/test_z_cmdline.py::test_sdist_fails tests/test_z_cmdline.py::test_no_setup_py_exits tests/test_z_cmdline.py::test_package_install_fails tests/test_z_cmdline.py::test_toxuone_env tests/test_z_cmdline.py::test_different_config_cwd tests/test_z_cmdline.py::test_json tests/test_z_cmdline.py::test_developz tests/test_z_cmdline.py::test_usedevelop tests/test_z_cmdline.py::test_usedevelop_mixed tests/test_z_cmdline.py::test_test_usedevelop[.] tests/test_z_cmdline.py::test_test_usedevelop[src] tests/test_z_cmdline.py::test_alwayscopy tests/test_z_cmdline.py::test_alwayscopy_default tests/test_z_cmdline.py::test_empty_activity_ignored tests/test_z_cmdline.py::test_empty_activity_shown_verbose tests/test_z_cmdline.py::test_test_piphelp tests/test_z_cmdline.py::test_notest tests/test_z_cmdline.py::test_PYC tests/test_z_cmdline.py::test_env_VIRTUALENV_PYTHON tests/test_z_cmdline.py::test_sdistonly tests/test_z_cmdline.py::test_separate_sdist tests/test_z_cmdline.py::test_sdist_latest tests/test_z_cmdline.py::test_installpkg tests/test_z_cmdline.py::test_envsitepackagesdir tests/test_z_cmdline.py::test_envsitepackagesdir_skip_missing_issue280 tests/test_z_cmdline.py::test_verbosity[] tests/test_z_cmdline.py::test_verbosity[-v] tests/test_z_cmdline.py::test_verbosity[-vv] tests/test_z_cmdline.py::test_envtmpdir tests/test_z_cmdline.py::test_missing_env_fails tests/test_z_cmdline.py::test_tox_quickstart_script
setup.py tox/__init__.py changelog/755.bugfix.rst
setup.py tox/__init__.py changelog/755.bugfix.rst