From 61e503a0046da8036b4bc9df32792ad804f3ae27 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 17 Sep 2019 11:45:59 +0100 Subject: [PATCH 1/8] Reformat azure posix file --- ci/azure/posix.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/azure/posix.yml b/ci/azure/posix.yml index 6093df46ffb60..281107559a38c 100644 --- a/ci/azure/posix.yml +++ b/ci/azure/posix.yml @@ -60,15 +60,21 @@ jobs: echo "Creating Environment" ci/setup_env.sh displayName: 'Setup environment and build pandas' + - script: | source activate pandas-dev ci/run_tests.sh displayName: 'Test' + - script: source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd + displayName: 'Build versions' + - task: PublishTestResults@2 inputs: testResultsFiles: 'test-data-*.xml' testRunTitle: ${{ format('{0}-$(CONDA_PY)', parameters.name) }} + displayName: 'Publish test results' + - powershell: | $junitXml = "test-data-single.xml" $(Get-Content $junitXml | Out-String) -match 'failures="(.*?)"' @@ -94,6 +100,7 @@ jobs: Write-Error "$($matches[1]) tests failed" } displayName: 'Check for test failures' + - script: | source activate pandas-dev python ci/print_skipped.py From 9d800c60900c28c1e9c4886b6eecbdcb16392e8f Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 17 Sep 2019 13:43:32 +0100 Subject: [PATCH 2/8] Adding failing test, simplifying print skipped and run tests --- ci/print_skipped.py | 53 +++++++++++++-------------------------- ci/run_tests.sh | 18 +++---------- pandas/tests/test_fail.py | 2 ++ 3 files changed, 24 insertions(+), 49 deletions(-) create mode 100644 pandas/tests/test_fail.py diff --git a/ci/print_skipped.py b/ci/print_skipped.py index 6bc1dcfcd320d..cd551e4cfa72f 100755 --- a/ci/print_skipped.py +++ b/ci/print_skipped.py @@ -1,52 +1,35 @@ #!/usr/bin/env python - -import math import os -import sys import xml.etree.ElementTree as et -def parse_results(filename): +def main(filename): + if not os.path.isfile(filename): + return + 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(): - test_files = ["test-data-single.xml", "test-data-multiple.xml", "test-data.xml"] - - print("SKIPPED TESTS:") - for fn in test_files: - if os.path.isfile(fn): - print(parse_results(fn)) - return 0 + yield None + yield {'class_name': current_class, + 'test_name': el.attrib["name"], + 'message': sk.attrib["message"]} if __name__ == "__main__": - sys.exit(main()) + print("SKIPPED TESTS:") + i = 1 + for file_type in ('-single', '-multi', ''): + for test_data in main("test-data{}.xml".format(file_type)): + if test_data is None: + print('-' * 80) + else: + print('#{i} {class_name}.{test_name}: {message}'.format( + **dict(test_data, i=i))) + i += 1 diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 27d3fcb4cf563..280bfdf5e46b3 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -1,31 +1,21 @@ -#!/bin/bash +#!/bin/bash -e -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 +# Workaround for pytest-xdist (it collects different tests in the workers if PYTHONHASHSEED is not set) # 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))') +export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4 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 + if [[ "$LOCALE_OVERRIDE" != "$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 - if [ -n "$PATTERN" ]; then PATTERN=" and $PATTERN" diff --git a/pandas/tests/test_fail.py b/pandas/tests/test_fail.py new file mode 100644 index 0000000000000..e35217b3408b0 --- /dev/null +++ b/pandas/tests/test_fail.py @@ -0,0 +1,2 @@ +def test_fail(): + assert False, "Just to make sure that the CI fails for this, will remove" From fb826c0ebd2bf7d83ad9c86041726eeca3596bdc Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 17 Sep 2019 13:45:56 +0100 Subject: [PATCH 3/8] Testing if locale check is still broken --- ci/run_tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 280bfdf5e46b3..1fa2a6450f93d 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -13,7 +13,8 @@ if [ -n "$LOCALE_OVERRIDE" ]; then if [[ "$LOCALE_OVERRIDE" != "$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 + # Testing if this is still failing + exit 1 fi fi From 79fde270c2334052843705c69bc9dbb71d0c156a Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 17 Sep 2019 13:51:14 +0100 Subject: [PATCH 4/8] Black --- ci/print_skipped.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ci/print_skipped.py b/ci/print_skipped.py index cd551e4cfa72f..46d918eb69423 100755 --- a/ci/print_skipped.py +++ b/ci/print_skipped.py @@ -17,19 +17,24 @@ def main(filename): current_class = cn if old_class != current_class: yield None - yield {'class_name': current_class, - 'test_name': el.attrib["name"], - 'message': sk.attrib["message"]} + yield { + "class_name": current_class, + "test_name": el.attrib["name"], + "message": sk.attrib["message"], + } if __name__ == "__main__": print("SKIPPED TESTS:") i = 1 - for file_type in ('-single', '-multi', ''): + for file_type in ("-single", "-multi", ""): for test_data in main("test-data{}.xml".format(file_type)): if test_data is None: - print('-' * 80) + print("-" * 80) else: - print('#{i} {class_name}.{test_name}: {message}'.format( - **dict(test_data, i=i))) + print( + "#{i} {class_name}.{test_name}: {message}".format( + **dict(test_data, i=i) + ) + ) i += 1 From 456ca3cf429b8c465356c9b93f8e35359ad964fd Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 17 Sep 2019 17:09:25 +0100 Subject: [PATCH 5/8] Removing failing test that tested that the CI was capturing errors properly --- pandas/tests/test_fail.py | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 pandas/tests/test_fail.py diff --git a/pandas/tests/test_fail.py b/pandas/tests/test_fail.py deleted file mode 100644 index e35217b3408b0..0000000000000 --- a/pandas/tests/test_fail.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_fail(): - assert False, "Just to make sure that the CI fails for this, will remove" From c001857e007f957a294b4b6391bd620c7018e552 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 18 Sep 2019 14:28:33 +0100 Subject: [PATCH 6/8] Disabling locale test again, to pass CI in this PR --- ci/run_tests.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 1fa2a6450f93d..280bfdf5e46b3 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -13,8 +13,7 @@ if [ -n "$LOCALE_OVERRIDE" ]; then if [[ "$LOCALE_OVERRIDE" != "$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 - # Testing if this is still failing - exit 1 + # exit 1 fi fi From 571e205908e9be25ec716fcb6a0897b66361af28 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 18 Sep 2019 15:53:13 +0100 Subject: [PATCH 7/8] Restoring proxy settings (is this making tests run much slower?) --- ci/run_tests.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 280bfdf5e46b3..57f1ecf1e56f7 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -4,7 +4,6 @@ # 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))') -export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4 if [ -n "$LOCALE_OVERRIDE" ]; then export LC_ALL="$LOCALE_OVERRIDE" @@ -16,6 +15,10 @@ if [ -n "$LOCALE_OVERRIDE" ]; then # 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 + if [ -n "$PATTERN" ]; then PATTERN=" and $PATTERN" From b174abda3051b465ad16319ebf01744405bfd65c Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Wed, 18 Sep 2019 23:18:20 +0100 Subject: [PATCH 8/8] Fixed typo in file name --- ci/print_skipped.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/print_skipped.py b/ci/print_skipped.py index 46d918eb69423..e99e789a71fe8 100755 --- a/ci/print_skipped.py +++ b/ci/print_skipped.py @@ -27,7 +27,7 @@ def main(filename): if __name__ == "__main__": print("SKIPPED TESTS:") i = 1 - for file_type in ("-single", "-multi", ""): + for file_type in ("-single", "-multiple", ""): for test_data in main("test-data{}.xml".format(file_type)): if test_data is None: print("-" * 80)