Skip to content

Commit c5af282

Browse files
authored
CI: fix db usage in CI (#24529)
1 parent 091cfbb commit c5af282

File tree

5 files changed

+10
-21
lines changed

5 files changed

+10
-21
lines changed

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ matrix:
3434
include:
3535
- dist: trusty
3636
env:
37-
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network"
37+
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network)"
3838

3939
- dist: trusty
4040
env:
41-
- JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="not slow and db"
41+
- JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="(not slow or (single and db))"
4242
addons:
4343
apt:
4444
packages:
4545
- python-gtk2
4646

4747
- dist: trusty
4848
env:
49-
- JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="not slow and not network and db" LOCALE_OVERRIDE="zh_CN.UTF-8"
49+
- JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="((not slow and not network) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8"
5050

5151
- dist: trusty
5252
env:
53-
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="not slow and not network and db" PANDAS_TESTING_MODE="deprecate" COVERAGE=true
53+
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="((not slow and not network) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true
5454

5555
# In allow_failures
5656
- dist: trusty

pandas/conftest.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import collections
21
from datetime import date, time, timedelta
32
from decimal import Decimal
43
import importlib
@@ -55,24 +54,14 @@ def pytest_runtest_setup(item):
5554
if 'network' in item.keywords and item.config.getoption("--skip-network"):
5655
pytest.skip("skipping due to --skip-network")
5756

57+
if 'db' in item.keywords and item.config.getoption("--skip-db"):
58+
pytest.skip("skipping due to --skip-db")
59+
5860
if 'high_memory' in item.keywords and not item.config.getoption(
5961
"--run-high-memory"):
6062
pytest.skip(
6163
"skipping high memory test since --run-high-memory was not set")
6264

63-
# if "db" not explicitly set in the -m pattern, we skip the db tests
64-
pattern = item.config.getoption('-m')
65-
if 'db' in item.keywords and not pattern:
66-
pytest.skip('skipping db unless -m "db" is specified')
67-
elif 'db' in item.keywords and pattern:
68-
markers = collections.defaultdict(bool)
69-
for marker in item.iter_markers():
70-
markers[marker.name] = True
71-
markers['db'] = False
72-
db_in_pattern = not eval(pattern, {}, markers)
73-
if not db_in_pattern:
74-
pytest.skip('skipping db unless -m "db" is specified')
75-
7665

7766
# Configurations for all tests and all test modules
7867

pandas/util/_tester.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test(extra_args=None):
1616
import hypothesis # noqa
1717
except ImportError:
1818
raise ImportError("Need hypothesis>=3.58 to run tests")
19-
cmd = ['--skip-slow', '--skip-network']
19+
cmd = ['--skip-slow', '--skip-network', '--skip-db']
2020
if extra_args:
2121
if not isinstance(extra_args, list):
2222
extra_args = [extra_args]

test_fast.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
:: test on windows
22
set PYTHONHASHSEED=314159265
3-
pytest --skip-slow --skip-network -m "not single" -n 4 -r sXX --strict pandas
3+
pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX --strict pandas

test_fast.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# https://github.com/pytest-dev/pytest/issues/1075
66
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
77

8-
pytest pandas --skip-slow --skip-network -m "not single" -n 4 -r sxX --strict "$@"
8+
pytest pandas --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sxX --strict "$@"

0 commit comments

Comments
 (0)