codecov-io: # [Codecov](https://codecov.io/gh/tox-dev/tox-travis/pull/93?src=pr&el=h1) Report
> Merging [#93](https://codecov.io/gh/tox-dev/tox-travis/pull/93?src=pr&el=desc) into [master](https://codecov.io/gh/tox-dev/tox-travis/commit/53867873da9189cc04ed043147cbe1c915fb69d8?src=pr&el=desc) will **increase** coverage by `0.1%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff            @@
##           master      #93     +/-   ##
=========================================
+ Coverage   88.88%   88.99%   +0.1%     
=========================================
  Files           5        5             
  Lines         207      209      +2     
  Branches       47       48      +1     
=========================================
+ Hits          184      186      +2     
  Misses         19       19             
  Partials        4        4
```


| [Impacted Files](https://codecov.io/gh/tox-dev/tox-travis/pull/93?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/tox\_travis/hooks.py](https://codecov.io/gh/tox-dev/tox-travis/pull/93?src=pr&el=tree#diff-c3JjL3RveF90cmF2aXMvaG9va3MucHk=) | `100% <100%> (ø)` | :arrow_up: |

------

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

ryanhiebert: Sounds good. The release will be the test of that, though I'm fairly confident it will work from my experimenting on #91.
diff --git a/.travis.yml b/.travis.yml
index 5b2f4fe..efd799d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,21 +18,27 @@ install:
  - pip install wheel codecov coverage
  - python setup.py bdist_wheel
  - pip install ./dist/tox_travis-*.whl
-script:
- - tox --installpkg ./dist/tox_travis-*.whl --travis-after
+script: tox --installpkg ./dist/tox_travis-*.whl
 after_success: coverage combine && codecov
 
-branches:
-  only:
-    - master
-    - /^\d+(\.\d+)*$/
-matrix:
+if: tag IS present OR branch = master
+jobs:
   fast_finish: true
   include:
   - python: 3.6
     env: TOXENV=docs
   - python: 3.6
     env: TOXENV=desc
+  - stage: deploy
+    python: 3.6
+    env: TRAVIS_STAGE=deploy
+    install: true
+    script: true
+    after_success: true
+
+stages:
+  - name: deploy
+    if: tag IS present
 
 deploy:
   provider: pypi
@@ -41,6 +47,5 @@ deploy:
     secure: KjQrEjwmfP+jqdHNQ6bJoNjOJHHz0kirrSORat2uJTulXaUs/nuDcZqTu7gxMFaM92z3eJZzTZmxO71cDhJiBt+FQhEtL/q8wd7Fv5d5v5EIlLFNqdEyCaTthSgXQa/HJTtbzjdFIEN8qCofHu+zEWMnb1ZHgUcK7hZHMCrHcVF4kD+k1myNro+1Pp/sGIUMUOkqocz+8OI2FuEQh0txXl0MLf2UEk53EK2noD4D/fm/YDDYJbAWlNPBbCBaU/ZGfzuFivh00bx9lAg7UB6t/A3iIasRUiAJbHdxvrxxGFAeOV/t09TcTtEcwBRyPe8JzSuReCROccyFB2TLOzfkt9h7TkdC2CWrMmXpI6UogTct++r3kavdsJuAZMbSy1jrnxkxtB1CW7DOly4v4JuyewpET7CnTjkhd9zIowESwJFjxwmns63AS2okQdPTCqsbbNp53Jk5fpf6qXwMFdaHT1kU1MpwoQPT0HnwLz3xybvjgfgu3t4KfEBvc0DCp89VMjCM9xkKTlziZkwOhXqaNhu+cVqo1/eUY/HDT/7V7xiL/U6U11UOrqtxkdDofoIl4NuiT7uoVaVctm/Y4kBEkJRZCwcjRsZJ0c06SvMvxhMDBUEM5IiXS6tH6Zp08MDYlclpKFGKdzOrxP2X0rVFIZ99KLyhfRNZuZcu92tDpP8=
   on:
     tags: true
-    python: 3.6
-    condition: $TOXENV != docs && $TOXENV != desc
+    condition: $TRAVIS_STAGE = deploy
   distributions: bdist_wheel
diff --git a/HISTORY.rst b/HISTORY.rst
index fe03e3a..c508bfe 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,11 @@
 0.10 (TBD)
 ++++++++++
 
+* Deprecate the After All feature.
+  Travis now has `Build Stages`_, which are a better solution.
+
+.. _`Build Stages`: https://docs.travis-ci.com/user/build-stages
+
 
 0.9 (2017-11-12)
 ++++++++++++++++
diff --git a/docs/after.rst b/docs/after.rst
index 4de27af..da02c95 100644
--- a/docs/after.rst
+++ b/docs/after.rst
@@ -2,6 +2,22 @@
 After All
 =========
 
+.. deprecated:: 0.10
+
+.. warning::
+
+  This feature is deprecated.
+
+  Travis has added `Build Stages`_,
+  which are a better solution to this problem.
+  You will also likely want to check out `Conditions`_,
+  which make it much easier to determine
+  which jobs, stages, and builds will run.
+
+.. _`Build Stages`: https://docs.travis-ci.com/user/build-stages
+.. _`Conditions`: https://docs.travis-ci.com/user/conditional-builds-stages-jobs
+
+
 Inspired by `travis-after-all`_ and `travis_after_all`_,
 this feature allows a job to wait for other jobs to finish
 before it calls itself complete.
@@ -77,7 +93,7 @@ that corresponds to using the above ``travis:after`` section:
 This example deploys when the build is from a tag
 and the build is on Python 3.5
 and the build is using DJANGO="1.8".
-Together ``tox --travis-after`` and Tox's ``on`` conditions
+Together ``tox --travis-after`` and Travis' ``on`` conditions
 make sure that the deploy only happens after all tests pass.
 
 If any configuration item does not match,
diff --git a/src/tox_travis/hooks.py b/src/tox_travis/hooks.py
index 7624593..9b84632 100644
--- a/src/tox_travis/hooks.py
+++ b/src/tox_travis/hooks.py
@@ -51,6 +51,13 @@ def tox_configure(config):
         for envconfig in config.envconfigs.values():
             envconfig.ignore_outcome = False
 
+    # after
+    if config.option.travis_after:
+        print('The after all feature has been deprecated. Check out Travis\' '
+              'build stages, which are a better solution. '
+              'See https://tox-travis.readthedocs.io/en/stable/after.html '
+              'for more details.', file=sys.stderr)
+
 
 def tox_subcommand_test_post(config):
     """Wait for this job if the configuration matches."""
diff --git a/tox.ini b/tox.ini
index d1bb173..898e673 100644
--- a/tox.ini
+++ b/tox.ini
@@ -28,9 +28,6 @@ deps =
 commands =
     python setup.py check --restructuredtext --strict
 
-[travis:after]
-toxenv = py36
-
 [flake8]
 ignore = D203
 

Consider deprecating travis:after in favor of Build Stages
https://blog.travis-ci.com/2017-05-11-introducing-build-stages

I don't have any plans to remove travis:after, but with the announcement of build stages for Travis, I'm watching it closely, and considering whether it will fully cover the use-cases that travis:after does. I suspect that it will end up as the better option, and that we will end up adding a note to the docs declaring that the better fix.

Right now it's still early days, and we need to watch and see. There are still bugs in this beta feature that need to be ironed out, but I'm very glad to see Travis supporting this feature natively.
diff --git a/tests/test_after.py b/tests/test_after.py
index b48316b..7d934d4 100644
--- a/tests/test_after.py
+++ b/tests/test_after.py
@@ -1,15 +1,65 @@
 """Tests of the --travis-after flag."""
 import pytest
 import py
+import subprocess
+from contextlib import contextmanager
 from tox_travis.after import (
     travis_after,
     after_config_matches,
 )
 
 
+ini = b"""
+[tox]
+envlist = py35, py36
+"""
+
+coverage_config = b"""
+[run]
+branch = True
+parallel = True
+source = tox_travis
+
+[paths]
+source =
+    src
+    */site-packages
+"""
+
+
 class TestAfter:
     """Test the logic of waiting for other jobs to finish."""
 
+    def call(self, command):
+        """Return the raw output of the given command."""
+        proc = subprocess.Popen(
+            command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        stdout, stderr = proc.communicate()
+        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')
+
+    @contextmanager
+    def configure(self, tmpdir, monkeypatch, tox_ini, version):
+        """Configure the environment for a test."""
+        origdir = tmpdir.chdir()
+        tmpdir.join('tox.ini').write(tox_ini)
+        tmpdir.join('.coveragerc').write(coverage_config)
+        monkeypatch.setenv('TRAVIS', 'true')
+        monkeypatch.setenv('TRAVIS_PYTHON_VERSION', version)
+
+        yield
+
+        # Change back to the original directory
+        # Copy .coverage.* report files
+        origdir.chdir()
+        for f in tmpdir.listdir(lambda f: f.basename.startswith('.coverage.')):
+            f.copy(origdir)
+
+    def test_after_deprecated(self, tmpdir, monkeypatch):
+        """Show deprecation message when using --travis-after."""
+        with self.configure(tmpdir, monkeypatch, ini, '3.6'):
+            _, _, stderr = self.call(['tox', '-l', '--travis-after'])
+            assert 'The after all feature has been deprecated.' in stderr
+
     def test_pull_request(self, mocker, monkeypatch, capsys):
         """Pull requests should not run after-all."""
         mocker.patch('tox_travis.after.after_config_matches',
diff --git a/tests/test_envlist.py b/tests/test_envlist.py
index 91daef9..72890a3 100644
--- a/tests/test_envlist.py
+++ b/tests/test_envlist.py
@@ -210,7 +210,7 @@ class TestToxEnv:
             assert self.tox_envs() == expected
 
     def test_travis_config_filename(self, tmpdir, monkeypatch):
-        """Give the correct env for CPython 2.7."""
+        """Give the correct env for manual filename."""
         with self.configure(tmpdir, monkeypatch, tox_ini, 'CPython', 3, 6,
                             ini_filename='spam.ini'):
             assert self.tox_envs(ini_filename='spam.ini') == ['py36']

pip install -e .
parse_log_pytest
pytest
pytest pytest-mock mock coverage_pth
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
coverage==6.2
coverage-pth==0.0.2
distlib==0.3.9
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-mock==3.6.1
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tox==3.28.0
-e git+https://github.com/tox-dev/tox-travis.git@53867873da9189cc04ed043147cbe1c915fb69d8#egg=tox_travis
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: tox-travis
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
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==6.2
      - coverage-pth==0.0.2
      - distlib==0.3.9
      - filelock==3.4.1
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - mock==5.2.0
      - platformdirs==2.4.0
      - pytest-mock==3.6.1
      - six==1.17.0
      - tox==3.28.0
      - virtualenv==20.17.1
prefix: /opt/conda/envs/tox-travis

tests/test_after.py::TestAfter::test_after_deprecated
tests/test_envlist.py::TestToxEnv::test_travis_config_filename tests/test_envlist.py::TestToxEnv::test_travis_default_26 tests/test_envlist.py::TestToxEnv::test_travis_default_27 tests/test_envlist.py::TestToxEnv::test_travis_default_32 tests/test_envlist.py::TestToxEnv::test_travis_default_33 tests/test_envlist.py::TestToxEnv::test_travis_default_34 tests/test_envlist.py::TestToxEnv::test_travis_default_pypy tests/test_envlist.py::TestToxEnv::test_travis_default_pypy3 tests/test_envlist.py::TestToxEnv::test_travis_python_version_py27 tests/test_envlist.py::TestToxEnv::test_travis_python_version_py35 tests/test_envlist.py::TestToxEnv::test_travis_python_version_pypy tests/test_envlist.py::TestToxEnv::test_travis_python_version_pypy3 tests/test_envlist.py::TestToxEnv::test_travis_not_matching tests/test_envlist.py::TestToxEnv::test_travis_nightly tests/test_envlist.py::TestToxEnv::test_travis_override tests/test_envlist.py::TestToxEnv::test_respect_overridden_toxenv tests/test_envlist.py::TestToxEnv::test_keep_if_no_match tests/test_envlist.py::TestToxEnv::test_default_tox_ini_overrides tests/test_envlist.py::TestToxEnv::test_factors tests/test_envlist.py::TestToxEnv::test_match_and_keep tests/test_envlist.py::TestToxEnv::test_django_factors tests/test_envlist.py::TestToxEnv::test_non_python_factor tests/test_envlist.py::TestToxEnv::test_travis_factors_py27 tests/test_envlist.py::TestToxEnv::test_travis_factors_py35 tests/test_envlist.py::TestToxEnv::test_travis_factors_osx tests/test_envlist.py::TestToxEnv::test_travis_factors_py27_osx tests/test_envlist.py::TestToxEnv::test_travis_factors_language tests/test_envlist.py::TestToxEnv::test_travis_env_py27 tests/test_envlist.py::TestToxEnv::test_travis_env_py27_dj19 tests/test_envlist.py::TestToxEnv::test_travis_env_py35_dj110
tests/test_after.py::TestAfter::test_pull_request tests/test_after.py::TestAfter::test_not_after_config_matches tests/test_after.py::TestAfter::test_no_github_token tests/test_after.py::TestAfter::test_travis_environment_build_id tests/test_after.py::TestAfter::test_travis_environment_job_number tests/test_after.py::TestAfter::test_travis_environment_api_url tests/test_after.py::TestAfter::test_travis_env_polling_interval tests/test_after.py::TestAfter::test_travis_env_passed tests/test_after.py::TestAfter::test_travis_env_failed tests/test_after.py::TestAfter::test_after_config_matches_unconfigured tests/test_after.py::TestAfter::test_after_config_matches_toxenv_match tests/test_after.py::TestAfter::test_after_config_matches_toxenv_nomatch tests/test_after.py::TestAfter::test_after_config_matches_envlist_match tests/test_after.py::TestAfter::test_after_config_matches_envlist_nomatch tests/test_after.py::TestAfter::test_after_config_matches_env_match tests/test_after.py::TestAfter::test_after_config_matches_env_nomatch tests/test_envlist.py::TestToxEnv::test_not_travis tests/test_envlist.py::TestToxEnv::test_legacy_warning tests/test_envlist.py::TestToxEnv::test_travis_ignore_outcome tests/test_envlist.py::TestToxEnv::test_travis_ignore_outcome_unignore_outcomes tests/test_envlist.py::TestToxEnv::test_travis_ignore_outcome_not_unignore_outcomes tests/test_envlist.py::TestToxEnv::test_local_ignore_outcome_unignore_outcomes
docs/after.rst HISTORY.rst src/tox_travis/hooks.py .travis.yml tox.ini
docs/after.rst HISTORY.rst src/tox_travis/hooks.py .travis.yml tox.ini