From e085cd1fda0b25181b50fda237ce6e90edadd317 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 03:19:50 +0000 Subject: [PATCH 01/19] Running serial tests in the same process with --dist=loadscope instead of calling pytest twice, and renaming single to serial to keep consistency with pytest --- ci/run_tests.sh | 36 ++++++----------------------- pandas/tests/frame/test_rank.py | 2 +- pandas/tests/io/json/test_pandas.py | 4 ++-- pandas/tests/io/test_clipboard.py | 2 +- pandas/tests/io/test_feather.py | 2 +- pandas/tests/io/test_pytables.py | 2 +- pandas/tests/io/test_sql.py | 24 +++++++++---------- pandas/tests/series/test_rank.py | 2 +- pandas/tests/test_algos.py | 2 +- setup.cfg | 2 +- 10 files changed, 28 insertions(+), 50 deletions(-) diff --git a/ci/run_tests.sh b/ci/run_tests.sh index ee46da9f52eab..796a3567265cb 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -26,33 +26,11 @@ if [[ "not network" == *"$PATTERN"* ]]; then export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4; fi - -if [ -n "$PATTERN" ]; then - PATTERN=" and $PATTERN" +PYTEST="pytest -m \"$PATTERN\" --dist=loadscope -n auto -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS" +if [ "$COVERAGE" ]; then + COVERAGE_FNAME="/tmp/coverage.xml" + $PYTEST --cov=pandas --cov-report=xml:$COVERAGE_FNAME pandas + bash <(curl -s https://codecov.io/bash) -Z -c -f $COVERAGE_FNAME +else + $PYTEST pandas fi - -for TYPE in single multiple -do - if [ "$COVERAGE" ]; then - COVERAGE_FNAME="/tmp/coc-$TYPE.xml" - COVERAGE="-s --cov=pandas --cov-report=xml:$COVERAGE_FNAME" - fi - - TYPE_PATTERN=$TYPE - NUM_JOBS=1 - if [[ "$TYPE_PATTERN" == "multiple" ]]; then - TYPE_PATTERN="not single" - NUM_JOBS=2 - fi - - PYTEST_CMD="pytest -m \"$TYPE_PATTERN$PATTERN\" -n $NUM_JOBS -s --strict --durations=10 --junitxml=test-data-$TYPE.xml $TEST_ARGS $COVERAGE pandas" - echo $PYTEST_CMD - # if no tests are found (the case of "single and slow"), pytest exits with code 5, and would make the script fail, if not for the below code - sh -c "$PYTEST_CMD; ret=\$?; [ \$ret = 5 ] && exit 0 || exit \$ret" - - if [[ "$COVERAGE" && $? == 0 ]]; then - echo "uploading coverage for $TYPE tests" - echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME" - bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME - fi -done diff --git a/pandas/tests/frame/test_rank.py b/pandas/tests/frame/test_rank.py index e7a876bcf52d1..0e3b60212bf42 100644 --- a/pandas/tests/frame/test_rank.py +++ b/pandas/tests/frame/test_rank.py @@ -310,7 +310,7 @@ def test_rank_pct_true(self, method, exp): expected = DataFrame(exp) tm.assert_frame_equal(result, expected) - @pytest.mark.single + @pytest.mark.serial def test_pct_max_many_rows(self): # GH 18271 df = DataFrame({'A': np.arange(2**24 + 1), diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index ed954c76294b6..66702923e506f 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -846,7 +846,7 @@ def test_misc_example(self): assert_frame_equal(result, expected) @network - @pytest.mark.single + @pytest.mark.serial def test_round_trip_exception_(self): # GH 3867 csv = 'https://raw.github.com/hayd/lahman2012/master/csvs/Teams.csv' @@ -857,7 +857,7 @@ def test_round_trip_exception_(self): index=df.index, columns=df.columns), df) @network - @pytest.mark.single + @pytest.mark.serial def test_url(self): url = 'https://api.github.com/repos/pandas-dev/pandas/issues?per_page=5' # noqa result = read_json(url, convert_dates=True) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index bb73c6bc6b38b..f44b63c46f99c 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -115,7 +115,7 @@ def test_mock_clipboard(mock_clipboard): assert result == "abc" -@pytest.mark.single +@pytest.mark.serial @pytest.mark.clipboard @pytest.mark.skipif(not _DEPS_INSTALLED, reason="clipboard primitives not installed") diff --git a/pandas/tests/io/test_feather.py b/pandas/tests/io/test_feather.py index 19ecb378b6378..9ac2224b4b33b 100644 --- a/pandas/tests/io/test_feather.py +++ b/pandas/tests/io/test_feather.py @@ -15,7 +15,7 @@ pyarrow_version = LooseVersion(pyarrow.__version__) -@pytest.mark.single +@pytest.mark.serial class TestFeather(object): def check_error_on_write(self, df, exc): diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 84a0e3d867783..0847502cbdb1e 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -142,7 +142,7 @@ def teardown_method(self, method): pass -@pytest.mark.single +@pytest.mark.serial @pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning") class TestHDFStore(Base): diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index eeeb55cb8e70c..1703de5ccf601 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -863,7 +863,7 @@ def test_escaped_table_name(self): tm.assert_frame_equal(res, df) -@pytest.mark.single +@pytest.mark.serial class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi): """ Test the public API as it would be used directly @@ -1054,12 +1054,12 @@ def setup_method(self, load_iris_data): # super(_EngineToConnMixin, self).teardown_method(method) -@pytest.mark.single +@pytest.mark.serial class TestSQLApiConn(_EngineToConnMixin, TestSQLApi): pass -@pytest.mark.single +@pytest.mark.serial class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi): """ Test the public sqlite connection fallback API @@ -1931,32 +1931,32 @@ def test_schema_support(self): tm.assert_frame_equal(res1, res2) -@pytest.mark.single +@pytest.mark.serial class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy): pass -@pytest.mark.single +@pytest.mark.serial class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn): pass -@pytest.mark.single +@pytest.mark.serial class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy): pass -@pytest.mark.single +@pytest.mark.serial class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn): pass -@pytest.mark.single +@pytest.mark.serial class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy): pass -@pytest.mark.single +@pytest.mark.serial class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn): pass @@ -1964,7 +1964,7 @@ class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn): # ----------------------------------------------------------------------------- # -- Test Sqlite / MySQL fallback -@pytest.mark.single +@pytest.mark.serial class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest): """ Test the fallback mode against an in-memory sqlite database. @@ -2196,7 +2196,7 @@ def _skip_if_no_pymysql(): pytest.skip('pymysql not installed, skipping') -@pytest.mark.single +@pytest.mark.serial class TestXSQLite(SQLiteMixIn): @pytest.fixture(autouse=True) @@ -2403,7 +2403,7 @@ def clean_up(test_table_to_drop): clean_up(table_name) -@pytest.mark.single +@pytest.mark.serial @pytest.mark.skip(reason="gh-13611: there is no support for MySQL " "if SQLAlchemy is not installed") class TestXMySQL(MySQLMixIn): diff --git a/pandas/tests/series/test_rank.py b/pandas/tests/series/test_rank.py index da414a577ae0b..8cae89997c9df 100644 --- a/pandas/tests/series/test_rank.py +++ b/pandas/tests/series/test_rank.py @@ -496,7 +496,7 @@ def test_rank_first_pct(dtype, ser, exp): assert_series_equal(result, expected) -@pytest.mark.single +@pytest.mark.serial def test_pct_max_many_rows(): # GH 18271 s = Series(np.arange(2**24 + 1)) diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py index c9d403f6696af..36246491c66a9 100644 --- a/pandas/tests/test_algos.py +++ b/pandas/tests/test_algos.py @@ -1470,7 +1470,7 @@ def test_too_many_ndims(self): with pytest.raises(TypeError, match=msg): algos.rank(arr) - @pytest.mark.single + @pytest.mark.serial @pytest.mark.parametrize('values', [ np.arange(2**24 + 1), np.arange(2**25 + 2).reshape(2**24 + 1, 2)], diff --git a/setup.cfg b/setup.cfg index 44df79d1b60d2..25d66ee3ef6a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -92,7 +92,7 @@ split_penalty_logical_operator = 30 [tool:pytest] testpaths = pandas markers = - single: mark a test as single cpu only + serial: mark a test as single cpu only slow: mark a test as slow network: mark a test as network high_memory: mark a test as a high-memory only From f4c69946b95fe5510461f3c5d9ae0953f4290c19 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 03:37:05 +0000 Subject: [PATCH 02/19] Updating test publishing with the new file name --- ci/azure/linux.yml | 18 +++--------------- ci/azure/macos.yml | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/ci/azure/linux.yml b/ci/azure/linux.yml index fe64307e9d08f..5b9ba94fa46b0 100644 --- a/ci/azure/linux.yml +++ b/ci/azure/linux.yml @@ -50,26 +50,14 @@ jobs: source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd - task: PublishTestResults@2 inputs: - testResultsFiles: 'test-data-*.xml' + testResultsFiles: 'test-data.xml' testRunTitle: 'Linux' - powershell: | - $junitXml = "test-data-single.xml" + $junitXml = "test-data.xml" $(Get-Content $junitXml | Out-String) -match 'failures="(.*?)"' if ($matches[1] -eq 0) { - Write-Host "No test failures in test-data-single" - } - else - { - # note that this will produce $LASTEXITCODE=1 - Write-Error "$($matches[1]) tests failed" - } - - $junitXmlMulti = "test-data-multiple.xml" - $(Get-Content $junitXmlMulti | Out-String) -match 'failures="(.*?)"' - if ($matches[1] -eq 0) - { - Write-Host "No test failures in test-data-multi" + Write-Host "No test failures in test-data" } else { diff --git a/ci/azure/macos.yml b/ci/azure/macos.yml index 98409576a5a87..a0f15ec8f466b 100644 --- a/ci/azure/macos.yml +++ b/ci/azure/macos.yml @@ -38,26 +38,14 @@ jobs: source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd - task: PublishTestResults@2 inputs: - testResultsFiles: 'test-data-*.xml' + testResultsFiles: 'test-data.xml' testRunTitle: 'MacOS-35' - powershell: | - $junitXml = "test-data-single.xml" + $junitXml = "test-data.xml" $(Get-Content $junitXml | Out-String) -match 'failures="(.*?)"' if ($matches[1] -eq 0) { - Write-Host "No test failures in test-data-single" - } - else - { - # note that this will produce $LASTEXITCODE=1 - Write-Error "$($matches[1]) tests failed" - } - - $junitXmlMulti = "test-data-multiple.xml" - $(Get-Content $junitXmlMulti | Out-String) -match 'failures="(.*?)"' - if ($matches[1] -eq 0) - { - Write-Host "No test failures in test-data-multi" + Write-Host "No test failures in test-data" } else { From 3c4653e6e2124fa84800906f894e2792e0858e55 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 13:54:27 +0000 Subject: [PATCH 03/19] Standardizing pytest arguments in setup.cfg --- ci/azure/windows-py27.yml | 2 +- ci/azure/windows.yml | 2 +- ci/run_tests.sh | 2 +- setup.cfg | 8 +++++++- test.bat | 3 --- test.sh | 4 ---- test_fast.bat | 3 --- test_fast.sh | 8 -------- test_rebuild.sh | 6 ------ 9 files changed, 10 insertions(+), 28 deletions(-) delete mode 100644 test.bat delete mode 100755 test.sh delete mode 100644 test_fast.bat delete mode 100755 test_fast.sh delete mode 100755 test_rebuild.sh diff --git a/ci/azure/windows-py27.yml b/ci/azure/windows-py27.yml index 0d9aea816c4ad..993b7a181e0fc 100644 --- a/ci/azure/windows-py27.yml +++ b/ci/azure/windows-py27.yml @@ -37,7 +37,7 @@ jobs: displayName: 'Build' - script: | call activate pandas-dev - pytest -m "not slow and not network" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %* + pytest -m "not slow and not network" --junitxml=test-data.xml pandas %* displayName: 'Test' - task: PublishTestResults@2 inputs: diff --git a/ci/azure/windows.yml b/ci/azure/windows.yml index b69c210ca27ba..570b5af11b07b 100644 --- a/ci/azure/windows.yml +++ b/ci/azure/windows.yml @@ -28,7 +28,7 @@ jobs: displayName: 'Build' - script: | call activate pandas-dev - pytest -m "not slow and not network" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %* + pytest -m "not slow and not network" --junitxml=test-data.xml pandas %* displayName: 'Test' - task: PublishTestResults@2 inputs: diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 796a3567265cb..bad9e99b87bfb 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -26,7 +26,7 @@ if [[ "not network" == *"$PATTERN"* ]]; then export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4; fi -PYTEST="pytest -m \"$PATTERN\" --dist=loadscope -n auto -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS" +PYTEST="pytest -m \"$PATTERN\" --junitxml=test-data.xml $TEST_ARGS" if [ "$COVERAGE" ]; then COVERAGE_FNAME="/tmp/coverage.xml" $PYTEST --cov=pandas --cov-report=xml:$COVERAGE_FNAME pandas diff --git a/setup.cfg b/setup.cfg index 25d66ee3ef6a0..9412f53fac2e5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -98,7 +98,13 @@ markers = high_memory: mark a test as a high-memory only clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL -addopts = --strict-data-files +addopts = --numprocesses=auto \ + --dist=loadscope \ + --strict \ + --durations=10 \ + --strict-data-files \ + -r sxX \ + --capture=no xfail_strict = True [coverage:run] diff --git a/test.bat b/test.bat deleted file mode 100644 index e07c84f257a69..0000000000000 --- a/test.bat +++ /dev/null @@ -1,3 +0,0 @@ -:: test on windows - -pytest --skip-slow --skip-network pandas -n 2 -r sxX --strict %* diff --git a/test.sh b/test.sh deleted file mode 100755 index 1255a39816f78..0000000000000 --- a/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -command -v coverage >/dev/null && coverage erase -command -v python-coverage >/dev/null && python-coverage erase -pytest pandas --cov=pandas -r sxX --strict diff --git a/test_fast.bat b/test_fast.bat deleted file mode 100644 index 81f30dd310e28..0000000000000 --- a/test_fast.bat +++ /dev/null @@ -1,3 +0,0 @@ -:: test on windows -set PYTHONHASHSEED=314159265 -pytest --skip-slow --skip-network -m "not single" -n 4 -r sXX --strict pandas diff --git a/test_fast.sh b/test_fast.sh deleted file mode 100755 index 1fb55e581d292..0000000000000 --- a/test_fast.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Workaround for pytest-xdist flaky collection order -# https://github.com/pytest-dev/pytest/issues/920 -# 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 "$@" diff --git a/test_rebuild.sh b/test_rebuild.sh deleted file mode 100755 index 65aa1098811a1..0000000000000 --- a/test_rebuild.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -python setup.py clean -python setup.py build_ext --inplace -coverage erase -pytest pandas --cov=pandas From c7c5a12ce536d06c0716d87edf7f93efd6baf654 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 14:19:32 +0000 Subject: [PATCH 04/19] Fixing multiline error in setup.cfg --- setup.cfg | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/setup.cfg b/setup.cfg index 9412f53fac2e5..1d3987f555441 100644 --- a/setup.cfg +++ b/setup.cfg @@ -98,13 +98,7 @@ markers = high_memory: mark a test as a high-memory only clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL -addopts = --numprocesses=auto \ - --dist=loadscope \ - --strict \ - --durations=10 \ - --strict-data-files \ - -r sxX \ - --capture=no +addopts = --numprocesses=auto --dist=loadscope --strict --durations=10 --strict-data-files -r sxX --capture=no xfail_strict = True [coverage:run] From d81c0a98869d3528f89576eb0b24f96ac61f4660 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 14:44:50 +0000 Subject: [PATCH 05/19] temporary removing --strict-data-files, and printing pytest call --- ci/run_tests.sh | 5 ++++- setup.cfg | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ci/run_tests.sh b/ci/run_tests.sh index bad9e99b87bfb..b79627dc3352f 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -29,8 +29,11 @@ fi PYTEST="pytest -m \"$PATTERN\" --junitxml=test-data.xml $TEST_ARGS" if [ "$COVERAGE" ]; then COVERAGE_FNAME="/tmp/coverage.xml" - $PYTEST --cov=pandas --cov-report=xml:$COVERAGE_FNAME pandas + PYTEST="$PYTEST --cov=pandas --cov-report=xml:$COVERAGE_FNAME" + echo "$PYTEST pandas" + $PYTEST pandas bash <(curl -s https://codecov.io/bash) -Z -c -f $COVERAGE_FNAME else + echo "$PYTEST pandas" $PYTEST pandas fi diff --git a/setup.cfg b/setup.cfg index 1d3987f555441..c0cf3c14bf509 100644 --- a/setup.cfg +++ b/setup.cfg @@ -98,7 +98,8 @@ markers = high_memory: mark a test as a high-memory only clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL -addopts = --numprocesses=auto --dist=loadscope --strict --durations=10 --strict-data-files -r sxX --capture=no +# TODO add --strict-data-files back (removing because it's failing, trying to understand why) +addopts = --numprocesses=auto --dist=loadscope --strict --durations=10 -r sxX --capture=no xfail_strict = True [coverage:run] From 36e63bc6bce3e1c60f3e7beb53e4acfaac961a65 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 17:01:39 +0000 Subject: [PATCH 06/19] Making the run tests script multiplatform by moving it to Python --- .travis.yml | 9 ++--- ci/azure/linux.yml | 2 +- ci/azure/macos.yml | 2 +- ci/azure/windows-py27.yml | 3 +- ci/azure/windows.yml | 3 +- ci/run_tests.py | 84 +++++++++++++++++++++++++++++++++++++++ ci/run_tests.sh | 39 ------------------ 7 files changed, 93 insertions(+), 49 deletions(-) create mode 100755 ci/run_tests.py delete mode 100755 ci/run_tests.sh diff --git a/.travis.yml b/.travis.yml index 03026647d6bb8..483f87d6b159d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,15 +107,12 @@ script: - echo "script start" - source activate pandas-dev - ci/run_build_docs.sh - - ci/run_tests.sh + - python ci/run_tests.py after_script: - echo "after_script start" - source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd - - if [ -e test-data-single.xml ]; then - ci/print_skipped.py test-data-single.xml; - fi - - if [ -e test-data-multiple.xml ]; then - ci/print_skipped.py test-data-multiple.xml; + - if [ -e test-data.xml ]; then + ci/print_skipped.py test-data.xml; fi - echo "after_script done" diff --git a/ci/azure/linux.yml b/ci/azure/linux.yml index 5b9ba94fa46b0..28b05fb5c4355 100644 --- a/ci/azure/linux.yml +++ b/ci/azure/linux.yml @@ -43,7 +43,7 @@ jobs: - script: | export PATH=$HOME/miniconda3/bin:$PATH source activate pandas-dev - ci/run_tests.sh + python ci/run_tests.py displayName: 'Test' - script: | export PATH=$HOME/miniconda3/bin:$PATH diff --git a/ci/azure/macos.yml b/ci/azure/macos.yml index a0f15ec8f466b..58a86c63f8519 100644 --- a/ci/azure/macos.yml +++ b/ci/azure/macos.yml @@ -31,7 +31,7 @@ jobs: - script: | export PATH=$HOME/miniconda3/bin:$PATH source activate pandas-dev - ci/run_tests.sh + python ci/run_tests.py displayName: 'Test' - script: | export PATH=$HOME/miniconda3/bin:$PATH diff --git a/ci/azure/windows-py27.yml b/ci/azure/windows-py27.yml index 993b7a181e0fc..2601a56451687 100644 --- a/ci/azure/windows-py27.yml +++ b/ci/azure/windows-py27.yml @@ -12,6 +12,7 @@ jobs: py36_np121: ENV_FILE: ci/deps/azure-windows-27.yaml CONDA_PY: "27" + PATTERN: "not slow and not network" steps: - task: CondaEnvironment@1 @@ -37,7 +38,7 @@ jobs: displayName: 'Build' - script: | call activate pandas-dev - pytest -m "not slow and not network" --junitxml=test-data.xml pandas %* + python ci\\run_tests.py displayName: 'Test' - task: PublishTestResults@2 inputs: diff --git a/ci/azure/windows.yml b/ci/azure/windows.yml index 570b5af11b07b..b900fbc1135e9 100644 --- a/ci/azure/windows.yml +++ b/ci/azure/windows.yml @@ -12,6 +12,7 @@ jobs: py36_np14: ENV_FILE: ci/deps/azure-windows-36.yaml CONDA_PY: "36" + PATTERN: "not slow and not network" steps: - task: CondaEnvironment@1 @@ -28,7 +29,7 @@ jobs: displayName: 'Build' - script: | call activate pandas-dev - pytest -m "not slow and not network" --junitxml=test-data.xml pandas %* + python ci\\run_tests.py displayName: 'Test' - task: PublishTestResults@2 inputs: diff --git a/ci/run_tests.py b/ci/run_tests.py new file mode 100755 index 0000000000000..6c380cb890632 --- /dev/null +++ b/ci/run_tests.py @@ -0,0 +1,84 @@ +#!/bin/env python +import os +import sys +import random +import tempfile +import warnings + + +def set_environ(pattern, locale): + """ + Set environment variables needed for running the tests. + """ + # Workaround for pytest-xdist flaky collection order + # https://github.com/pytest-dev/pytest/issues/920 + # https://github.com/pytest-dev/pytest/issues/1075 + os.environ['PYTHONHASHSEED'] = str(random.randint(1, 4294967295)) + + if locale: + os.environ['LC_ALL'] = os.environ['LANG'] = locale + import pandas + pandas_locale = pandas.get_option('display.encoding') + if pandas_locale != locale: + # TODO raise exception instead of warning when + # https://github.com/pandas-dev/pandas/issues/23923 is fixed + warnings.warn(('pandas could not detect the locale. ' + 'System locale: {}, ' + 'pandas detected: {}').format(locale, + pandas_locale)) + + if 'not network' in pattern: + os.environ['http_proxy'] = os.environ['https_proxy'] = 'http://1.2.3.4' + + +def pytest_command(pattern, coverage_file): + """ + Build and return the pytest command to run. + """ + cmd = 'pytest --junitxml=test-data.xml' + + if pattern: + cmd += ' -m "{}"'.format(pattern) + + if coverage_file: + cmd += ' --cov=pandas --cov-report=xml:{}'.format(coverage_file) + + return cmd + + +def run_tests(pattern, locale=None, coverage_file=False): + """ + Run tests with the specified environment. + + Parameters + ---------- + pattern : str + Tests to execute based on pytest markers (e.g. "slow and not network"). + locale : str, optional + Locale to use instead of the system defaule (e.g. "it_IT.UTF8"). + coverage_file : str, optional + If provided, the file path where to save the coverage. + """ + set_environ(pattern, locale) + pytest_cmd = pytest_command(pattern, coverage_file) + sys.stderr.write('{}\n'.format(pytest_cmd)) + os.system(pytest_cmd) + + if coverage_file: + upload_coverage_cmd = ('bash <(curl -s https://codecov.io/bash) ' + '-Z -c -f {}'.format(coverage_file)) + sys.stderr.write('{}\n'.format(upload_coverage_cmd)) + os.system(upload_coverage_cmd) + os.remove(coverage_file) + + +if __name__ == '__main__': + pattern = os.environ.get('PATTERN', '') + locale = os.environ.get('LOCALE_OVERRIDE') + coverage_file = None + if os.environ.get('COVERAGE', '') != '': + if sys.platform == 'win32': + raise RuntimeError('Coverage can not be uploaded from Windows') + coverage_file = os.path.join(tempfile.gettempdir(), + 'pandas-coverage.xml') + run_tests(pattern, locale, coverage_file) diff --git a/ci/run_tests.sh b/ci/run_tests.sh deleted file mode 100755 index b79627dc3352f..0000000000000 --- a/ci/run_tests.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$DOC" ]; then - echo "We are not running pytest as this is a doc-build" - exit 0 -fi - -# Workaround for pytest-xdist flaky collection order -# https://github.com/pytest-dev/pytest/issues/920 -# https://github.com/pytest-dev/pytest/issues/1075 -export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))') - -if [ -n "$LOCALE_OVERRIDE" ]; then - export LC_ALL="$LOCALE_OVERRIDE" - export LANG="$LOCALE_OVERRIDE" - PANDAS_LOCALE=`python -c 'import pandas; pandas.get_option("display.encoding")'` - if [[ "$LOCALE_OVERIDE" != "$PANDAS_LOCALE" ]]; then - echo "pandas could not detect the locale. System locale: $LOCALE_OVERRIDE, pandas detected: $PANDAS_LOCALE" - # TODO Not really aborting the tests until https://github.com/pandas-dev/pandas/issues/23923 is fixed - # exit 1 - fi -fi -if [[ "not network" == *"$PATTERN"* ]]; then - export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4; -fi - -PYTEST="pytest -m \"$PATTERN\" --junitxml=test-data.xml $TEST_ARGS" -if [ "$COVERAGE" ]; then - COVERAGE_FNAME="/tmp/coverage.xml" - PYTEST="$PYTEST --cov=pandas --cov-report=xml:$COVERAGE_FNAME" - echo "$PYTEST pandas" - $PYTEST pandas - bash <(curl -s https://codecov.io/bash) -Z -c -f $COVERAGE_FNAME -else - echo "$PYTEST pandas" - $PYTEST pandas -fi From 7ecfc97e39cede3d465c3246fdeebfcded4e3265 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 5 Dec 2018 17:48:23 +0000 Subject: [PATCH 07/19] Removing --dist argument and making numprocesses=0, as auto seems to be suprisingly slower. Restoing --strict-data-files too --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index c0cf3c14bf509..43c3166582f8b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -98,8 +98,8 @@ markers = high_memory: mark a test as a high-memory only clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL -# TODO add --strict-data-files back (removing because it's failing, trying to understand why) -addopts = --numprocesses=auto --dist=loadscope --strict --durations=10 -r sxX --capture=no +# addopts = --numprocesses=auto --dist=loadscope --strict --strict-data-files --durations=10 -r sxX --capture=no +addopts = --numprocesses=0 --strict --strict-data-files --durations=10 -r sxX --capture=no xfail_strict = True [coverage:run] From 38ba587d1e0d26c3b45746663f522055e9e67809 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 11 Dec 2018 02:04:41 +0000 Subject: [PATCH 08/19] Fixing calls to the shell, adding duplicate jobs to compare performance travis vs azure, and single vs multi-core --- .travis.yml | 7 +++++- ci/azure/linux.yml | 13 ++++++++++++ ci/run_tests.py | 53 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 483f87d6b159d..63db500d2c3bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,11 @@ matrix: - python: 3.5 include: + # TODO remove, this is repeated just to see how faster is using multiple processes in travis + - dist: trusty + env: + - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network" TESTS_JOBS="auto" + - dist: trusty env: - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network" @@ -55,7 +60,7 @@ matrix: - JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="not slow and not network" PANDAS_TESTING_MODE="deprecate" COVERAGE=true - dist: trusty env: - - JOB="3.7, NumPy dev" ENV_FILE="ci/deps/travis-37-numpydev.yaml" PATTERN="not slow and not network" TEST_ARGS="-W error" PANDAS_TESTING_MODE="deprecate" + - JOB="3.7, NumPy dev" ENV_FILE="ci/deps/travis-37-numpydev.yaml" PATTERN="not slow and not network" WARNINGS_ARE_ERRORS="true" PANDAS_TESTING_MODE="deprecate" addons: apt: packages: diff --git a/ci/azure/linux.yml b/ci/azure/linux.yml index 28b05fb5c4355..c2b020594ba7f 100644 --- a/ci/azure/linux.yml +++ b/ci/azure/linux.yml @@ -9,6 +9,19 @@ jobs: strategy: maxParallel: 11 matrix: + # TODO remove, just comparing the speed travis/azure, single/multi-core + py37_single_core: + ENV_FILE: ci/deps/travis-37.yaml + CONDA_PY: "37" + PATTERN: "not slow and not network" + + # TODO remove, just comparing the speed travis/azure, single/multi-core + py37_multi_core: + ENV_FILE: ci/deps/travis-37.yaml + CONDA_PY: "37" + PATTERN: "not slow and not network" + TESTS_JOBS: "auto" + py27_np_120: ENV_FILE: ci/deps/azure-27-compat.yaml CONDA_PY: "27" diff --git a/ci/run_tests.py b/ci/run_tests.py index 6c380cb890632..4621b6889d982 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -1,9 +1,15 @@ #!/bin/env python import os +import subprocess import sys import random import tempfile +import time import warnings +try: + from urllib.request import urlretrieve +except ImportError: # py2 + from urllib import urlretrieve def set_environ(pattern, locale): @@ -35,15 +41,41 @@ def pytest_command(pattern, coverage_file): """ Build and return the pytest command to run. """ - cmd = 'pytest --junitxml=test-data.xml' + cmd = ['pytest', '--junitxml=test-data.xml'] if pattern: - cmd += ' -m "{}"'.format(pattern) + cmd += ['-m', pattern] if coverage_file: - cmd += ' --cov=pandas --cov-report=xml:{}'.format(coverage_file) + cmd += ['--cov=pandas', '--cov-report=xml:{}'.format(coverage_file)] - return cmd + test_jobs = os.environ.get('TESTS_JOBS', 0) + if test_jobs: + cmd += ['-n', str(test_jobs), '--dist', 'loadfile'] + + if os.environ.get('WARNINGS_ARE_ERRORS'): + cmd += ['-W', 'error'] + + return cmd + ['pandas'] + + +def upload_coverage(coverage_file): + """ + Download codecov.io script and run it to upload coverage for coverage_file. + """ + script_fname = os.path.join(os.path.dirname(coverage_file), + 'codecov_script.sh') + urlretrieve('https://codecov.io/bash', script_fname) + upload_coverage_cmd = ['bash', + script_fname, + '-Z', + '-c', + '-f', + coverage_file] + sys.stderr.write('{}\n'.format(' '.join(upload_coverage_cmd))) + subprocess.check_call(upload_coverage_cmd.split()) + os.remove(script_fname) + os.remove(coverage_file) def run_tests(pattern, locale=None, coverage_file=False): @@ -61,15 +93,14 @@ def run_tests(pattern, locale=None, coverage_file=False): """ set_environ(pattern, locale) pytest_cmd = pytest_command(pattern, coverage_file) - sys.stderr.write('{}\n'.format(pytest_cmd)) - os.system(pytest_cmd) + sys.stderr.write('{}\n'.format(' '.join(pytest_cmd))) + start = time.time() + subprocess.check_call(pytest_cmd) + tests_run_in_seconds = int(time.time() - start) + sys.stdout.write('Tests run in {} seconds\n'.format(tests_run_in_seconds)) if coverage_file: - upload_coverage_cmd = ('bash <(curl -s https://codecov.io/bash) ' - '-Z -c -f {}'.format(coverage_file)) - sys.stderr.write('{}\n'.format(upload_coverage_cmd)) - os.system(upload_coverage_cmd) - os.remove(coverage_file) + upload_coverage(coverage_file) if __name__ == '__main__': From 8f595c30d66aca7b77fc2d398c6f39d00a1c0216 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 11 Dec 2018 02:52:49 +0000 Subject: [PATCH 09/19] Updating new test with the old single marker --- pandas/tests/io/test_gbq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/test_gbq.py b/pandas/tests/io/test_gbq.py index 6dd16107bc7d7..0f8f6a3358f6f 100644 --- a/pandas/tests/io/test_gbq.py +++ b/pandas/tests/io/test_gbq.py @@ -109,7 +109,7 @@ def test_read_gbq_without_dialect_warns_future_change(monkeypatch): pd.read_gbq("SELECT 1") -@pytest.mark.single +@pytest.mark.serial class TestToGBQIntegrationWithServiceAccountKeyPath(object): @classmethod From 5b4efd5e6ea581a2893154591935b3ead4a732cc Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 11 Dec 2018 14:51:02 +0000 Subject: [PATCH 10/19] removing builds to benchmark tests speed, and making tests run in parallel by default --- .travis.yml | 5 ----- ci/azure/linux.yml | 13 ------------- ci/run_tests.py | 6 +++--- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63db500d2c3bb..7eb63b7355722 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,11 +32,6 @@ matrix: - python: 3.5 include: - # TODO remove, this is repeated just to see how faster is using multiple processes in travis - - dist: trusty - env: - - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network" TESTS_JOBS="auto" - - dist: trusty env: - JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network" diff --git a/ci/azure/linux.yml b/ci/azure/linux.yml index c2b020594ba7f..28b05fb5c4355 100644 --- a/ci/azure/linux.yml +++ b/ci/azure/linux.yml @@ -9,19 +9,6 @@ jobs: strategy: maxParallel: 11 matrix: - # TODO remove, just comparing the speed travis/azure, single/multi-core - py37_single_core: - ENV_FILE: ci/deps/travis-37.yaml - CONDA_PY: "37" - PATTERN: "not slow and not network" - - # TODO remove, just comparing the speed travis/azure, single/multi-core - py37_multi_core: - ENV_FILE: ci/deps/travis-37.yaml - CONDA_PY: "37" - PATTERN: "not slow and not network" - TESTS_JOBS: "auto" - py27_np_120: ENV_FILE: ci/deps/azure-27-compat.yaml CONDA_PY: "27" diff --git a/ci/run_tests.py b/ci/run_tests.py index 4621b6889d982..30da58b22ac11 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -49,9 +49,9 @@ def pytest_command(pattern, coverage_file): if coverage_file: cmd += ['--cov=pandas', '--cov-report=xml:{}'.format(coverage_file)] - test_jobs = os.environ.get('TESTS_JOBS', 0) - if test_jobs: - cmd += ['-n', str(test_jobs), '--dist', 'loadfile'] + test_jobs = os.environ.get('TESTS_JOBS', 'auto') + if test_jobs != '0': + cmd += ['-n', test_jobs, '--dist', 'loadfile'] if os.environ.get('WARNINGS_ARE_ERRORS'): cmd += ['-W', 'error'] From 91f64824083a1cd9b298805009e0b8878ac69552 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 11 Dec 2018 16:36:54 +0000 Subject: [PATCH 11/19] Not running tests in doc build --- ci/run_tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/run_tests.py b/ci/run_tests.py index 30da58b22ac11..32e7a7dd5d7e8 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -91,6 +91,9 @@ def run_tests(pattern, locale=None, coverage_file=False): coverage_file : str, optional If provided, the file path where to save the coverage. """ + if os.environ.get('DOC'): + sys.stdout.write('We are not running pytest as this is a doc-build\n') + return set_environ(pattern, locale) pytest_cmd = pytest_command(pattern, coverage_file) sys.stderr.write('{}\n'.format(' '.join(pytest_cmd))) From 1fae84cb92fc9129c3e0360eb0a34a7f2227078c Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 11 Dec 2018 17:27:11 +0000 Subject: [PATCH 12/19] Integrating print_skipped into run_tests --- ci/print_skipped.py | 54 --------------------------------------------- ci/run_tests.py | 29 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 57 deletions(-) delete mode 100755 ci/print_skipped.py diff --git a/ci/print_skipped.py b/ci/print_skipped.py deleted file mode 100755 index 67bc7b556cd43..0000000000000 --- a/ci/print_skipped.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -import sys -import math -import xml.etree.ElementTree as et - - -def parse_results(filename): - tree = et.parse(filename) - root = tree.getroot() - skipped = [] - - current_class = '' - i = 1 - assert i - 1 == len(skipped) - for el in root.findall('testcase'): - cn = el.attrib['classname'] - for sk in el.findall('skipped'): - old_class = current_class - current_class = cn - name = '{classname}.{name}'.format(classname=current_class, - name=el.attrib['name']) - msg = sk.attrib['message'] - out = '' - if old_class != current_class: - ndigits = int(math.log(i, 10) + 1) - - # 4 for : + space + # + space - out += ('-' * (len(name + msg) + 4 + ndigits) + '\n') - out += '#{i} {name}: {msg}'.format(i=i, name=name, msg=msg) - skipped.append(out) - i += 1 - assert i - 1 == len(skipped) - assert i - 1 == len(skipped) - # assert len(skipped) == int(root.attrib['skip']) - return '\n'.join(skipped) - - -def main(args): - print('SKIPPED TESTS:') - for fn in args.filename: - print(parse_results(fn)) - return 0 - - -def parse_args(): - import argparse - parser = argparse.ArgumentParser() - parser.add_argument('filename', nargs='+', help='XUnit file to parse') - return parser.parse_args() - - -if __name__ == '__main__': - sys.exit(main(parse_args())) diff --git a/ci/run_tests.py b/ci/run_tests.py index 32e7a7dd5d7e8..724c4eff9554e 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -1,4 +1,5 @@ #!/bin/env python +import math import os import subprocess import sys @@ -6,6 +7,7 @@ import tempfile import time import warnings +import xml.etree.ElementTree try: from urllib.request import urlretrieve except ImportError: # py2 @@ -37,11 +39,23 @@ def set_environ(pattern, locale): os.environ['http_proxy'] = os.environ['https_proxy'] = 'http://1.2.3.4' -def pytest_command(pattern, coverage_file): +def skipped_tests(fname): + """ + Yield the list of skipped tests, including a header to be printed. + """ + root = xml.etree.ElementTree.parse(fname).getroot() + for item in root.findall('testcase'): + for skipped in item.findall('skipped'): + yield (item.attrib['classname'], + item.attrib['name'], + skipped.attrib['message']) + + +def pytest_command(pattern, junit_xml, coverage_file): """ Build and return the pytest command to run. """ - cmd = ['pytest', '--junitxml=test-data.xml'] + cmd = ['pytest', '--junitxml={}'.format(junit_xml)] if pattern: cmd += ['-m', pattern] @@ -94,12 +108,21 @@ def run_tests(pattern, locale=None, coverage_file=False): if os.environ.get('DOC'): sys.stdout.write('We are not running pytest as this is a doc-build\n') return + junit_xml = 'test-data.xml' set_environ(pattern, locale) - pytest_cmd = pytest_command(pattern, coverage_file) + pytest_cmd = pytest_command(pattern, junit_xml, coverage_file) sys.stderr.write('{}\n'.format(' '.join(pytest_cmd))) start = time.time() subprocess.check_call(pytest_cmd) tests_run_in_seconds = int(time.time() - start) + + prev_class = None + for i, (class_, name, msg) in enumerate(skipped_tests(junit_xml)): + if prev_class is not None and class_ != prev_class: + sys.stdout.write('{}\n'.format('-' * 100)) + sys.stdout.write('#{} {}.{}: {}\n'.format(i + 1, class_, name, msg)) + prev_class = class_ + sys.stdout.write('Tests run in {} seconds\n'.format(tests_run_in_seconds)) if coverage_file: From a6a4c30225de538a4d19685721b48863dcbb7774 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Thu, 13 Dec 2018 15:05:30 +0000 Subject: [PATCH 13/19] Removing duplicate print_versions, and moving show_versions to the script, so it's always printed in any CI --- .travis.yml | 8 -------- ci/run_tests.py | 5 ++++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7eb63b7355722..b8240717ff13e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,11 +108,3 @@ script: - source activate pandas-dev - ci/run_build_docs.sh - python ci/run_tests.py - -after_script: - - echo "after_script start" - - source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd - - if [ -e test-data.xml ]; then - ci/print_skipped.py test-data.xml; - fi - - echo "after_script done" diff --git a/ci/run_tests.py b/ci/run_tests.py index 724c4eff9554e..4a6e5fc0e1218 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -122,7 +122,10 @@ def run_tests(pattern, locale=None, coverage_file=False): sys.stdout.write('{}\n'.format('-' * 100)) sys.stdout.write('#{} {}.{}: {}\n'.format(i + 1, class_, name, msg)) prev_class = class_ - + sys.stdout.write('{}\n'.format('=' * 100)) + import pandas + pandas.show_versions() + sys.stdout.write('{}\n'.format('=' * 100)) sys.stdout.write('Tests run in {} seconds\n'.format(tests_run_in_seconds)) if coverage_file: From e1024839b50358be3f190d9f473d4d346e0e6a0f Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Fri, 14 Dec 2018 03:35:44 +0000 Subject: [PATCH 14/19] Removing unused math import --- ci/run_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/run_tests.py b/ci/run_tests.py index 4a6e5fc0e1218..1d186f0469039 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -1,5 +1,4 @@ #!/bin/env python -import math import os import subprocess import sys From 57ebf799953053fa44ab9d99b60e5c87542f13fe Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sat, 29 Dec 2018 19:41:44 +0000 Subject: [PATCH 15/19] Debuging timeout in 3.6 coverage build (call to pytest should have the same exact parameters as before now) --- ci/run_tests.py | 7 ++++--- setup.cfg | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/run_tests.py b/ci/run_tests.py index 1d186f0469039..b70cad1c726a2 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -62,9 +62,10 @@ def pytest_command(pattern, junit_xml, coverage_file): if coverage_file: cmd += ['--cov=pandas', '--cov-report=xml:{}'.format(coverage_file)] - test_jobs = os.environ.get('TESTS_JOBS', 'auto') - if test_jobs != '0': - cmd += ['-n', test_jobs, '--dist', 'loadfile'] + # test_jobs = os.environ.get('TESTS_JOBS', 'auto') + # if test_jobs != '0': + # cmd += ['-n', test_jobs, '--dist', 'loadfile'] + cmd += ['-n', '2'] if os.environ.get('WARNINGS_ARE_ERRORS'): cmd += ['-W', 'error'] diff --git a/setup.cfg b/setup.cfg index 1d011965232e9..db25ae1ae39fc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,7 +72,8 @@ markers = clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL # addopts = --numprocesses=auto --dist=loadscope --strict --strict-data-files --durations=10 -r sxX --capture=no -addopts = --numprocesses=0 --strict --strict-data-files --durations=10 -r sxX --capture=no +# addopts = --numprocesses=0 --strict --strict-data-files --durations=10 -r sxX --capture=no +addopts = --strict --strict-data-files --durations=10 --capture=no xfail_strict = True [coverage:run] From 7739174b298dad673da6804d5d1978b582872b6d Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sat, 29 Dec 2018 23:24:16 +0000 Subject: [PATCH 16/19] Fixing pytest number of jobs --- ci/run_tests.py | 7 +++---- setup.cfg | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ci/run_tests.py b/ci/run_tests.py index b70cad1c726a2..1d186f0469039 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -62,10 +62,9 @@ def pytest_command(pattern, junit_xml, coverage_file): if coverage_file: cmd += ['--cov=pandas', '--cov-report=xml:{}'.format(coverage_file)] - # test_jobs = os.environ.get('TESTS_JOBS', 'auto') - # if test_jobs != '0': - # cmd += ['-n', test_jobs, '--dist', 'loadfile'] - cmd += ['-n', '2'] + test_jobs = os.environ.get('TESTS_JOBS', 'auto') + if test_jobs != '0': + cmd += ['-n', test_jobs, '--dist', 'loadfile'] if os.environ.get('WARNINGS_ARE_ERRORS'): cmd += ['-W', 'error'] diff --git a/setup.cfg b/setup.cfg index db25ae1ae39fc..2db53ca7840bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -71,9 +71,7 @@ markers = high_memory: mark a test as a high-memory only clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL -# addopts = --numprocesses=auto --dist=loadscope --strict --strict-data-files --durations=10 -r sxX --capture=no -# addopts = --numprocesses=0 --strict --strict-data-files --durations=10 -r sxX --capture=no -addopts = --strict --strict-data-files --durations=10 --capture=no +addopts = --strict --strict-data-files --durations=10 -r sxX --capture=no xfail_strict = True [coverage:run] From 4f8fa729ac5cc2168c569e623ba2d02faa73348c Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sun, 30 Dec 2018 00:54:22 +0000 Subject: [PATCH 17/19] Adding quotes around pattern parameter (may not be getting it, and running slow tests when it's not intended) --- ci/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run_tests.py b/ci/run_tests.py index 1d186f0469039..3c6ffe000bb10 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -57,7 +57,7 @@ def pytest_command(pattern, junit_xml, coverage_file): cmd = ['pytest', '--junitxml={}'.format(junit_xml)] if pattern: - cmd += ['-m', pattern] + cmd += ['-m', '"{}"'.format(pattern)] if coverage_file: cmd += ['--cov=pandas', '--cov-report=xml:{}'.format(coverage_file)] From 6bcf26ab179c0d8557624ca0ceaf17c9ce36ea25 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sun, 30 Dec 2018 02:47:28 +0000 Subject: [PATCH 18/19] Reverting the quotes in the pattern, as it was wrong --- ci/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run_tests.py b/ci/run_tests.py index 3c6ffe000bb10..1d186f0469039 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -57,7 +57,7 @@ def pytest_command(pattern, junit_xml, coverage_file): cmd = ['pytest', '--junitxml={}'.format(junit_xml)] if pattern: - cmd += ['-m', '"{}"'.format(pattern)] + cmd += ['-m', pattern] if coverage_file: cmd += ['--cov=pandas', '--cov-report=xml:{}'.format(coverage_file)] From aafaff35a4298a87c81d734e03e656e52be484a8 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sun, 30 Dec 2018 12:41:35 +0000 Subject: [PATCH 19/19] Add missing pattern to windows build --- ci/azure/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/azure/windows.yml b/ci/azure/windows.yml index 599ac1a2a4c7d..c5d25aa03824b 100644 --- a/ci/azure/windows.yml +++ b/ci/azure/windows.yml @@ -16,6 +16,7 @@ jobs: py27_np121: ENV_FILE: ci/deps/azure-windows-27.yaml CONDA_PY: "27" + PATTERN: "not slow and not network and not db" steps: - task: CondaEnvironment@1