Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: fix db usage in CI #24529

Merged
merged 4 commits into from
Jan 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ matrix:
include:
- dist: trusty
env:
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network"
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network)"

- dist: trusty
env:
- JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="not slow and db"
- JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="(not slow or (single and db))"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized about my mistake now. not slow and db just runs db tests. I think not slow or db should be enough, I guess I'm missing something, but I don't see why the single is needed here.

I think it's probably better to add the brackets in run_tests.sh.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, the single that is added makes this a bit odd, eg. we are adding the single and pattern, and we only want to run the db tests when its single

addons:
apt:
packages:
- python-gtk2

- dist: trusty
env:
- 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"
- 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"

- dist: trusty
env:
- 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
- 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

# In allow_failures
- dist: trusty
Expand Down
17 changes: 3 additions & 14 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import collections
from datetime import date, time, timedelta
from decimal import Decimal
import importlib
Expand Down Expand Up @@ -55,24 +54,14 @@ def pytest_runtest_setup(item):
if 'network' in item.keywords and item.config.getoption("--skip-network"):
pytest.skip("skipping due to --skip-network")

if 'db' in item.keywords and item.config.getoption("--skip-db"):
pytest.skip("skipping due to --skip-db")

if 'high_memory' in item.keywords and not item.config.getoption(
"--run-high-memory"):
pytest.skip(
"skipping high memory test since --run-high-memory was not set")

# if "db" not explicitly set in the -m pattern, we skip the db tests
pattern = item.config.getoption('-m')
if 'db' in item.keywords and not pattern:
pytest.skip('skipping db unless -m "db" is specified')
elif 'db' in item.keywords and pattern:
markers = collections.defaultdict(bool)
for marker in item.iter_markers():
markers[marker.name] = True
markers['db'] = False
db_in_pattern = not eval(pattern, {}, markers)
if not db_in_pattern:
pytest.skip('skipping db unless -m "db" is specified')


# Configurations for all tests and all test modules

Expand Down
2 changes: 1 addition & 1 deletion pandas/util/_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test(extra_args=None):
import hypothesis # noqa
except ImportError:
raise ImportError("Need hypothesis>=3.58 to run tests")
cmd = ['--skip-slow', '--skip-network']
cmd = ['--skip-slow', '--skip-network', '--skip-db']
if extra_args:
if not isinstance(extra_args, list):
extra_args = [extra_args]
Expand Down
2 changes: 1 addition & 1 deletion test_fast.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
:: test on windows
set PYTHONHASHSEED=314159265
pytest --skip-slow --skip-network -m "not single" -n 4 -r sXX --strict pandas
pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX --strict pandas
2 changes: 1 addition & 1 deletion test_fast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# https://github.com/pytest-dev/pytest/issues/1075
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')

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