Repository: tox-dev/tox
Pull request #680 (2017-11-24 09:12:30)

Exclude inline comments from envlist
Using inline comments in envlist config
```ini
[tox]
envlist = one, # two,
          # three,
          four, # five
```
results in adding them as envs
```sh
$ tox -l
one
#two
four
#five
```
This PR fixes that
```sh
$ tox -l
one
four
```

andreif: It's a bit of mystery why only Python 3.3 failed on the first commit in PR tests https://travis-ci.org/tox-dev/tox/builds/306663767. 
In my fork all except 2.6 failed as expected https://travis-ci.org/andreif/tox/builds/306663499
RonnyPfannschmidt: i restarted the build to check if this is a temporary hickup
RonnyPfannschmidt: the restarted env doesnt seem to expose the issue - @obestwalter its not clear whts causing the temporary hickup, but it indicates a hidden unreliability in the setup
codecov[bot]: # [Codecov](https://codecov.io/gh/tox-dev/tox/pull/680?src=pr&el=h1) Report
> Merging [#680](https://codecov.io/gh/tox-dev/tox/pull/680?src=pr&el=desc) into [master](https://codecov.io/gh/tox-dev/tox/commit/9cc893457f5ad3780d87ead53c8c83abe7dfe064?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

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

```diff
@@           Coverage Diff           @@
##           master     #680   +/-   ##
=======================================
  Coverage   90.77%   90.77%           
=======================================
  Files          11       11           
  Lines        2373     2373           
  Branches      402      403    +1     
=======================================
  Hits         2154     2154           
  Misses        144      144           
  Partials       75       75
```


| [Impacted Files](https://codecov.io/gh/tox-dev/tox/pull/680?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [tox/config.py](https://codecov.io/gh/tox-dev/tox/pull/680?src=pr&el=tree#diff-dG94L2NvbmZpZy5weQ==) | `95.08% <100%> (ø)` | :arrow_up: |

------

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


Patch:
diff --git a/tox/config.py b/tox/config.py
index b056431b..e6c57c18 100755
--- a/tox/config.py
+++ b/tox/config.py
@@ -906,8 +906,8 @@ class parseini:
 def _split_env(env):
     """if handed a list, action="append" was used for -e """
     if not isinstance(env, list):
-        if '\n' in env:
-            env = ','.join(env.split('\n'))
+        env = [e.split('#', 1)[0].strip() for e in env.split('\n')]
+        env = ','.join([e for e in env if e])
         env = [env]
     return mapcat(_expand_envstr, env)
 
diff --git a/tox/session.py b/tox/session.py
index f61b5044..7d9e41d7 100644
--- a/tox/session.py
+++ b/tox/session.py
@@ -128,7 +128,7 @@ class Action(object):
             fout = self._initlogpath(self.id)
             fout.write("actionid: %s\nmsg: %s\ncmdargs: %r\n\n" % (self.id, self.msg, args))
             fout.flush()
-            self.popen_outpath = outpath = py.path.local(fout.name)
+            outpath = py.path.local(fout.name)
             fin = outpath.open()
             fin.read()  # read the header, so it won't be written to stdout
             stdout = fout
@@ -182,7 +182,7 @@ class Action(object):
             except KeyboardInterrupt:
                 self.report.keyboard_interrupt()
                 popen.wait()
-                raise KeyboardInterrupt()
+                raise
             ret = popen.wait()
         finally:
             self._popenlist.remove(popen)


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index 30da4f04..6e7bbd5a 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -2180,7 +2180,7 @@ class TestCmdInvocation:
         initproj('listenvs_all_verbose_description', filedefs={
             'tox.ini': '''
             [tox]
-            envlist={py27,py36}-{windows,linux}
+            envlist={py27,py36}-{windows,linux} # py26
             [testenv]
             description= py27: run pytest on Python 2.7
                          py36: run pytest on Python 3.6