File enviroment.patch of Package python-tox-travis
From 8c57631a869da172d103141c17f374f031b2d296 Mon Sep 17 00:00:00 2001
From: Ryan Hiebert <ryan@ryanhiebert.com>
Date: Tue, 30 Jul 2019 11:24:44 -0500
Subject: [PATCH] Override default_envlist to fix tests (#137)
* Override default_envlist to fix tests
* Upgrade pip for AppVeyor
Lifted from https://github.com/rpkilby/tox-factor
---
.appveyor.yml | 5 +++--
src/tox_travis/hooks.py | 4 +++-
tests/test_envlist.py | 8 ++++++++
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/tox_travis/hooks.py b/src/tox_travis/hooks.py
index 9b84632..e4661dd 100644
--- a/src/tox_travis/hooks.py
+++ b/src/tox_travis/hooks.py
@@ -44,7 +44,9 @@ def tox_configure(config):
'envs that Tox should run are declared in the tox config.',
file=sys.stderr)
autogen_envconfigs(config, undeclared)
- config.envlist = envlist
+ # Also set envlist_default to allow us to inspect outcomes
+ # via tox -l in the tests, until a better solution arrives.
+ config.envlist_default = config.envlist = envlist
# Override ignore_outcomes
if override_ignore_outcome(ini):
diff --git a/tests/test_envlist.py b/tests/test_envlist.py
index 3de3cf3..4a3b167 100644
--- a/tests/test_envlist.py
+++ b/tests/test_envlist.py
@@ -2,6 +2,7 @@
import py
import re
import subprocess
+import pytest
from contextlib import contextmanager
@@ -293,6 +294,13 @@ def test_travis_override(self, tmpdir, monkeypatch):
with self.configure(tmpdir, monkeypatch, tox_ini, 'CPython', 2, 7):
assert self.tox_envs() == ['py27', 'docs']
+ # XFAIL because of changes to tox -l to make it show declared envs
+ # rather than the envs that will actually run, which is what we
+ # need to test. When a better option is available, we can get this
+ # test working again.
+ #
+ # # https://github.com/tox-dev/tox/pull/1284#issuecomment-488411553
+ @pytest.mark.xfail
def test_respect_overridden_toxenv(self, tmpdir, monkeypatch):
"""Ensure that TOXENV if given is not changed."""
with self.configure(tmpdir, monkeypatch, tox_ini, 'CPython', 2, 7):