Skip to content

Commit

Permalink
cache_dir: use $TOX_ENV_DIR/ prefix if set
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Oct 30, 2018
1 parent 233c2a2 commit 303433e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from __future__ import print_function

import json
import os
from collections import OrderedDict

import attr
Expand Down Expand Up @@ -275,7 +276,10 @@ def pytest_addoption(parser):
dest="cacheclear",
help="remove all cache contents at start of test run.",
)
parser.addini("cache_dir", default=".pytest_cache", help="cache directory path.")
cache_dir_default = ".pytest_cache"
if "TOX_ENV_DIR" in os.environ:
cache_dir_default = os.path.join(os.environ["TOX_ENV_DIR"], cache_dir_default)
parser.addini("cache_dir", default=cache_dir_default, help="cache directory path.")
group.addoption(
"--lfnf",
"--last-failed-no-failures",
Expand Down

0 comments on commit 303433e

Please sign in to comment.