summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2015-05-12 14:20:46 +0200
committerholger krekel <holger@merlinux.eu>2015-05-12 14:20:46 +0200
commit63e565d660867ee8794d0e9d06f45240108910df (patch)
tree3933ea03de3783650994b0570ef1b73450ece2b5
parent904844849ae03baab8d37b87267aed27c55e8db0 (diff)
downloadtox-63e565d660867ee8794d0e9d06f45240108910df.tar.gz
rename internal files -- in any case tox offers no external API except for the
experimental plugin hooks, use tox internals at your own risk.
-rw-r--r--CHANGELOG4
-rw-r--r--setup.py2
-rw-r--r--tests/test_config.py12
-rw-r--r--tests/test_interpreters.py2
-rw-r--r--tests/test_venv.py16
-rw-r--r--tests/test_z_cmdline.py4
-rw-r--r--tox/__init__.py4
-rw-r--r--tox/__main__.py5
-rw-r--r--tox/_exception.py28
-rw-r--r--tox/_pytestplugin.py10
-rw-r--r--tox/config.py (renamed from tox/_config.py)2
-rw-r--r--tox/session.py (renamed from tox/_cmdline.py)25
-rw-r--r--tox/venv.py (renamed from tox/_venv.py)2
13 files changed, 49 insertions, 67 deletions
diff --git a/CHANGELOG b/CHANGELOG
index ca59f7c..0df3656 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -48,6 +48,10 @@
for testenv sections. Can be used from plugins through the
tox_add_option hook.
+- rename internal files -- tox offers no external API except for the
+ experimental plugin hooks, use tox internals at your own risk.
+
+
1.9.2
-----------
diff --git a/setup.py b/setup.py
index 8ea49c8..8edec31 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@ def main():
description='virtualenv-based automation of test activities',
long_description=open("README.rst").read(),
url='http://tox.testrun.org/',
- version='2.0.0.dev4',
+ version='2.0.0.dev5',
license='http://opensource.org/licenses/MIT',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
author='holger krekel',
diff --git a/tests/test_config.py b/tests/test_config.py
index e9c941a..cce293e 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -4,9 +4,9 @@ from textwrap import dedent
import py
import pytest
import tox
-import tox._config
-from tox._config import * # noqa
-from tox._venv import VirtualEnv
+import tox.config
+from tox.config import * # noqa
+from tox.venv import VirtualEnv
class TestVenvConfig:
@@ -1321,12 +1321,12 @@ class TestHashseedOption:
"""
if make_hashseed is None:
make_hashseed = lambda: '123456789'
- original_make_hashseed = tox._config.make_hashseed
- tox._config.make_hashseed = make_hashseed
+ original_make_hashseed = tox.config.make_hashseed
+ tox.config.make_hashseed = make_hashseed
try:
config = newconfig(args, tox_ini)
finally:
- tox._config.make_hashseed = original_make_hashseed
+ tox.config.make_hashseed = original_make_hashseed
return config.envconfigs
def _get_envconfig(self, newconfig, args=None, tox_ini=None):
diff --git a/tests/test_interpreters.py b/tests/test_interpreters.py
index 01d6508..d2cfa27 100644
--- a/tests/test_interpreters.py
+++ b/tests/test_interpreters.py
@@ -3,7 +3,7 @@ import os
import pytest
from tox.interpreters import * # noqa
-from tox._config import get_plugin_manager
+from tox.config import get_plugin_manager
@pytest.fixture
diff --git a/tests/test_venv.py b/tests/test_venv.py
index b32affd..d00b655 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -3,8 +3,8 @@ import tox
import pytest
import os
import sys
-import tox._config
-from tox._venv import * # noqa
+import tox.config
+from tox.venv import * # noqa
from tox.interpreters import NoInterpreterInfo
# def test_global_virtualenv(capfd):
@@ -253,14 +253,14 @@ def test_install_recreate(newmocksession, tmpdir):
def test_test_hashseed_is_in_output(newmocksession):
- original_make_hashseed = tox._config.make_hashseed
- tox._config.make_hashseed = lambda: '123456789'
+ original_make_hashseed = tox.config.make_hashseed
+ tox.config.make_hashseed = lambda: '123456789'
try:
mocksession = newmocksession([], '''
[testenv]
''')
finally:
- tox._config.make_hashseed = original_make_hashseed
+ tox.config.make_hashseed = original_make_hashseed
venv = mocksession.getenv('python')
venv.update()
venv.test()
@@ -620,7 +620,7 @@ def test_sethome_only_on_option(newmocksession, monkeypatch):
mocksession = newmocksession([], "")
venv = mocksession.getenv('python')
action = mocksession.newaction(venv, "qwe", [])
- monkeypatch.setattr(tox._venv, "hack_home_env", None)
+ monkeypatch.setattr(tox.venv, "hack_home_env", None)
venv._install(["x"], action=action)
@@ -636,7 +636,7 @@ def test_sethome_works_on_option(newmocksession, monkeypatch):
def test_hack_home_env(tmpdir):
- from tox._venv import hack_home_env
+ from tox.venv import hack_home_env
env = hack_home_env(tmpdir, "http://index")
assert env["HOME"] == str(tmpdir)
assert env["PIP_INDEX_URL"] == "http://index"
@@ -650,7 +650,7 @@ def test_hack_home_env(tmpdir):
def test_hack_home_env_passthrough(tmpdir, monkeypatch):
- from tox._venv import hack_home_env
+ from tox.venv import hack_home_env
env = hack_home_env(tmpdir, "http://index")
monkeypatch.setattr(os, "environ", env)
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index b5cbc4e..2461790 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -9,8 +9,8 @@ except ImportError:
pytest_plugins = "pytester"
-from tox._cmdline import Session
-from tox._config import parseconfig
+from tox.session import Session
+from tox.config import parseconfig
def test_report_protocol(newconfig):
diff --git a/tox/__init__.py b/tox/__init__.py
index 7e71062..a23225b 100644
--- a/tox/__init__.py
+++ b/tox/__init__.py
@@ -1,5 +1,5 @@
#
-__version__ = '2.0.0.dev4'
+__version__ = '2.0.0.dev5'
from .hookspecs import hookspec, hookimpl # noqa
@@ -24,4 +24,4 @@ class exception:
class MissingDependency(Error):
""" a dependency could not be found or determined. """
-from tox._cmdline import main as cmdline # noqa
+from tox.session import main as cmdline # noqa
diff --git a/tox/__main__.py b/tox/__main__.py
index d60aab2..e28d746 100644
--- a/tox/__main__.py
+++ b/tox/__main__.py
@@ -1,3 +1,4 @@
-from tox._cmdline import main
+from tox.session import main
-main()
+if __name__ == "__main__":
+ main()
diff --git a/tox/_exception.py b/tox/_exception.py
deleted file mode 100644
index 9917f09..0000000
--- a/tox/_exception.py
+++ /dev/null
@@ -1,28 +0,0 @@
-
-class Error(Exception):
- def __str__(self):
- return "%s: %s" % (self.__class__.__name__, self.args[0])
-
-
-class UnsupportedInterpreter(Error):
- "signals an unsupported Interpreter"
-
-
-class InterpreterNotFound(Error):
- "signals that an interpreter could not be found"
-
-
-class InvocationError(Error):
- """ an error while invoking a script. """
-
-
-class MissingFile(Error):
- """ an error while invoking a script. """
-
-
-class MissingDirectory(Error):
- """ a directory did not exist. """
-
-
-class MissingDependency(Error):
- """ a dependency could not be found or determined. """
diff --git a/tox/_pytestplugin.py b/tox/_pytestplugin.py
index 9d7488a..ee85acc 100644
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -6,10 +6,10 @@ import sys
from py.builtin import _isbytes, _istext, print_
from fnmatch import fnmatch
import time
-from tox._config import parseconfig
-from tox._venv import VirtualEnv
-from tox._cmdline import Action
-from tox.result import ResultLog
+from .config import parseconfig
+from .venv import VirtualEnv
+from .session import Action
+from .result import ResultLog
def pytest_configure():
@@ -134,7 +134,7 @@ class pcallMock:
@pytest.fixture
def mocksession(request):
- from tox._cmdline import Session
+ from tox.session import Session
class MockSession(Session):
def __init__(self):
diff --git a/tox/_config.py b/tox/config.py
index 85ff822..8675286 100644
--- a/tox/_config.py
+++ b/tox/config.py
@@ -31,7 +31,7 @@ def get_plugin_manager():
# initialize plugin manager
pm = pluggy.PluginManager("tox")
pm.add_hookspecs(hookspecs)
- pm.register(tox._config)
+ pm.register(tox.config)
pm.register(tox.interpreters)
pm.load_setuptools_entrypoints("tox")
pm.check_pending()
diff --git a/tox/_cmdline.py b/tox/session.py
index 0c2f9d6..e886274 100644
--- a/tox/_cmdline.py
+++ b/tox/session.py
@@ -12,8 +12,8 @@ import os
import sys
import subprocess
from tox._verlib import NormalizedVersion, IrrationalVersionError
-from tox._venv import VirtualEnv
-from tox._config import parseconfig
+from tox.venv import VirtualEnv
+from tox.config import parseconfig
from tox.result import ResultLog
from subprocess import STDOUT
@@ -22,15 +22,20 @@ def now():
return py.std.time.time()
+def prepare(args):
+ config = parseconfig(args)
+ if config.option.help:
+ show_help(config)
+ raise SystemExit(0)
+ elif config.option.helpini:
+ show_help_ini(config)
+ raise SystemExit(0)
+ return config
+
+
def main(args=None):
try:
- config = parseconfig(args)
- if config.option.help:
- show_help(config)
- raise SystemExit(0)
- elif config.option.helpini:
- show_help_ini(config)
- raise SystemExit(0)
+ config = prepare(args)
retcode = Session(config).runcommand()
raise SystemExit(retcode)
except KeyboardInterrupt:
@@ -447,7 +452,7 @@ class Session:
def installpkg(self, venv, path):
"""Install package in the specified virtual environment.
- :param :class:`tox._config.VenvConfig`: Destination environment
+ :param :class:`tox.config.VenvConfig`: Destination environment
:param str path: Path to the distribution package.
:return: True if package installed otherwise False.
:rtype: bool
diff --git a/tox/_venv.py b/tox/venv.py
index d52a6e5..eb2fadc 100644
--- a/tox/_venv.py
+++ b/tox/venv.py
@@ -5,7 +5,7 @@ import re
import codecs
import py
import tox
-from tox._config import DepConfig
+from .config import DepConfig
class CreationConfig: