diff options
| author | holger krekel <holger@merlinux.eu> | 2013-01-28 10:49:58 +0100 |
|---|---|---|
| committer | holger krekel <holger@merlinux.eu> | 2013-01-28 10:49:58 +0100 |
| commit | d2625c0b3bfb17770bbf8bbd2512040a3900bd31 (patch) | |
| tree | 5dd666bbabc4b3d884940a44464c7a8bff3438fd | |
| parent | c15bab6734871340ad10415e39d64e39953f7cfb (diff) | |
| download | tox-d2625c0b3bfb17770bbf8bbd2512040a3900bd31.tar.gz | |
* introduce a --installpkg=path option which will skip creation of an sdist and instead install the given package.
* introduce --indexserver|-i ALL=... to override all indexserver settings.
| -rw-r--r-- | setup.py | 2 | ||||
| -rw-r--r-- | tests/test_config.py | 5 | ||||
| -rw-r--r-- | tests/test_z_cmdline.py | 11 | ||||
| -rw-r--r-- | tox/_cmdline.py | 11 | ||||
| -rw-r--r-- | tox/_config.py | 15 |
5 files changed, 36 insertions, 8 deletions
@@ -77,4 +77,4 @@ def main(): ) if __name__ == '__main__': - main() + main()
\ No newline at end of file diff --git a/tests/test_config.py b/tests/test_config.py index 8347ed0..687794a 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -743,6 +743,11 @@ class TestIndexServer: assert config.indexserver['default'].url == "qwe2" assert config.indexserver['name1'].url == "abc" + config = newconfig(["-i", "ALL=xzy"], inisource) + assert len(config.indexserver) == 2 + assert config.indexserver["default"].url == "xzy" + assert config.indexserver["name1"].url == "xzy" + class TestParseEnv: diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index fcded04..89d6e38 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -432,13 +432,21 @@ def test_sdist_latest(tmpdir, newconfig): distshare=%s sdistsrc={distshare}/pkg123-* """ % distshare) - distshare.ensure("pkg123-1.3.5.zip") + p0 = distshare.ensure("pkg123-1.3.5.zip") p = distshare.ensure("pkg123-1.4.5.zip") distshare.ensure("pkg123-1.4.5a1.zip") session = Session(config) sdist_path = session.sdist() assert sdist_path == p +def test_installpkg(tmpdir, newconfig): + p = tmpdir.ensure("pkg123-1.0.zip") + config = newconfig(["--installpkg=%s" % p], "") + session = Session(config) + sdist_path = session.sdist() + assert sdist_path == p + +@pytest.mark.xfailif("sys.platform == 'win32'") def test_envsitepackagesdir(cmd, initproj): initproj("pkg512-0.0.5", filedefs={ 'tox.ini': """ @@ -446,3 +454,4 @@ def test_envsitepackagesdir(cmd, initproj): grep '__version__.*=.*0\.0\.5' {envsitepackagesdir}/pkg512/__init__.py """}) result = cmd.run("tox") + diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 4d78dc7..a63765e 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -329,11 +329,14 @@ class Session: return False def sdist(self): - if not self.config.option.sdistonly and self.config.sdistsrc: - self.report.info("using sdistfile %r, skipping 'sdist' activity " % - str(self.config.sdistsrc)) - sdist_path = self.config.sdistsrc + if not self.config.option.sdistonly and (self.config.sdistsrc or + self.config.option.installpkg): + sdist_path = self.config.option.installpkg + if not sdist_path: + sdist_path = self.config.sdistsrc sdist_path = self._resolve_pkg(sdist_path) + self.report.info("using package %r, skipping 'sdist' activity " % + str(sdist_path)) else: try: sdist_path = self._makesdist() diff --git a/tox/_config.py b/tox/_config.py index 93d0123..76d283d 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -87,6 +87,8 @@ def prepare_parse(pkgname): help="skip invoking test commands.") parser.add_argument("--sdistonly", action="store_true", dest="sdistonly", help="only perform the sdist packaging activity.") + parser.add_argument("--installpkg", action="store", default=None, + help="use specified package for installation into venv") parser.add_argument('-i', action="append", dest="indexurl", metavar="URL", help="set indexserver url (if URL is of form name=url set the " @@ -196,9 +198,10 @@ class parseini: name, url = map(lambda x: x.strip(), line.split("=", 1)) config.indexserver[name] = IndexServerConfig(name, url) + override = False if config.option.indexurl: for urldef in config.option.indexurl: - m = re.match(r"(\w+)=(\S+)", urldef) + m = re.match(r"\W*(\w+)=(\S+)", urldef) if m is None: url = urldef name = "default" @@ -206,7 +209,15 @@ class parseini: name, url = m.groups() if not url: url = None - config.indexserver[name].url = url + if name != "ALL": + config.indexserver[name].url = url + else: + override = url + # let ALL override all existing entries + if override: + for name in config.indexserver: + config.indexserver[name] = IndexServerConfig(name, override) + print name, config.indexserver[name] reader.addsubstitions(toxworkdir=config.toxworkdir) config.distdir = reader.getpath(toxsection, "distdir", |
