From a263eb36578d72b71f1bb22220c08c6468a93bd0 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 25 Mar 2022 11:52:03 -0500 Subject: [PATCH 1/5] test: disambiguate log files for flakybot --- noxfile.py | 4 ++-- owlbot.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index e3f4d5c..0ab6290 100644 --- a/noxfile.py +++ b/noxfile.py @@ -103,7 +103,7 @@ def default(session, tests_path): session.run( "py.test", "--quiet", - f"--junitxml=unit_{session.python}_sponge_log.xml", + f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml", "--cov=db_dtypes", "--cov=tests/unit", "--cov-append", @@ -179,7 +179,7 @@ def prerelease(session, tests_path): session.run( "py.test", "--quiet", - f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml", + f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml", "--cov=db_dtypes", "--cov=tests/unit", "--cov-append", diff --git a/owlbot.py b/owlbot.py index ec5a5bf..ba0c1ea 100644 --- a/owlbot.py +++ b/owlbot.py @@ -84,12 +84,80 @@ s.replace( ["noxfile.py"], r''' +def default\(session, tests_path\): + # Install all test dependencies, then install this package in-place. + + constraints_path = str\( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + \) + session.install\( + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", + "-c", + constraints_path, + \) + + session.install\("-e", ".", "-c", constraints_path\) + + # Run py.test against the unit tests. + session.run\( + "py.test", + "--quiet", + f"--junitxml={os.path.split\(tests_path\)[-1]}_{session.python}_sponge_log.xml", + "--cov=db_dtypes", + "--cov=tests/unit", + "--cov-append", + "--cov-config=.coveragerc", + "--cov-report=", + "--cov-fail-under=0", + tests_path, + *session.posargs, + \) + + @nox.session\(python=UNIT_TEST_PYTHON_VERSIONS\) def unit\(session\): """Run the unit test suite.""" default\(session\) ''', r''' +def default(session, tests_path): + # Install all test dependencies, then install this package in-place. + + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + session.install( + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", + "-c", + constraints_path, + ) + + session.install("-e", ".", "-c", constraints_path) + + # Run py.test against the unit tests. + session.run( + "py.test", + "--quiet", + f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml", + "--cov=db_dtypes", + "--cov=tests/unit", + "--cov-append", + "--cov-config=.coveragerc", + "--cov-report=", + "--cov-fail-under=0", + tests_path, + *session.posargs, + ) + + def prerelease(session, tests_path): constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" @@ -154,7 +222,7 @@ def prerelease(session, tests_path): session.run( "py.test", "--quiet", - f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml", + f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml", "--cov=db_dtypes", "--cov=tests/unit", "--cov-append", From e743376e05c93dc369143c5cbeb10b1ccad8151d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 25 Mar 2022 16:54:21 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 98 ++---------------------------------------------------- 1 file changed, 2 insertions(+), 96 deletions(-) diff --git a/noxfile.py b/noxfile.py index 0ab6290..98b45ab 100644 --- a/noxfile.py +++ b/noxfile.py @@ -103,7 +103,7 @@ def default(session, tests_path): session.run( "py.test", "--quiet", - f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml", + f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=db_dtypes", "--cov=tests/unit", "--cov-append", @@ -115,104 +115,10 @@ def default(session, tests_path): ) -def prerelease(session, tests_path): - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) - - # PyArrow prerelease packages are published to an alternative PyPI host. - # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages - session.install( - "--extra-index-url", - "https://pypi.fury.io/arrow-nightlies/", - "--prefer-binary", - "--pre", - "--upgrade", - "pyarrow", - ) - session.install( - "--extra-index-url", - "https://pypi.anaconda.org/scipy-wheels-nightly/simple", - "--prefer-binary", - "--pre", - "--upgrade", - "pandas", - ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - # Because we test minimum dependency versions on the minimum Python - # version, the first version we test with in the unit tests sessions has a - # constraints file containing all dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - # We use --no-deps to ensure that pre-release versions aren't overwritten - # by the version ranges in setup.py. - session.install(*deps) - session.install("--no-deps", "-e", ".") - - # Print out prerelease package versions. - session.run("python", "-m", "pip", "freeze") - - # Run py.test against the unit tests. - session.run( - "py.test", - "--quiet", - f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml", - "--cov=db_dtypes", - "--cov=tests/unit", - "--cov-append", - "--cov-config=.coveragerc", - "--cov-report=", - "--cov-fail-under=0", - tests_path, - *session.posargs, - ) - - -@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) -def compliance(session): - """Run the compliance test suite.""" - default(session, os.path.join("tests", "compliance")) - - -@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) -def compliance_prerelease(session): - """Run the compliance test suite with prerelease dependencies.""" - prerelease(session, os.path.join("tests", "compliance")) - - @nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" - default(session, os.path.join("tests", "unit")) - - -@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) -def unit_prerelease(session): - """Run the unit test suite with prerelease dependencies.""" - prerelease(session, os.path.join("tests", "unit")) + default(session) @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) From 59b5e64e81c3aad9d84cd1da2b5cfc302cf47c99 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 25 Mar 2022 13:31:08 -0500 Subject: [PATCH 3/5] try different owlbot config --- owlbot.py | 73 ++++--------------------------------------------------- 1 file changed, 5 insertions(+), 68 deletions(-) diff --git a/owlbot.py b/owlbot.py index ba0c1ea..64edf0c 100644 --- a/owlbot.py +++ b/owlbot.py @@ -81,83 +81,20 @@ ["noxfile.py"], r"def default\(session\):", "def default(session, tests_path):" ) s.replace(["noxfile.py"], r'os.path.join\("tests", "unit"\),', "tests_path,") +s.replace( + ["noxfile.py"], + r'f"--junitxml=unit_{session.python}_sponge_log.xml",', + r'f"--junitxml={os.path.split\(tests_path\)[-1]}_{session.python}_sponge_log.xml",', +) s.replace( ["noxfile.py"], r''' -def default\(session, tests_path\): - # Install all test dependencies, then install this package in-place. - - constraints_path = str\( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - \) - session.install\( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - \) - - session.install\("-e", ".", "-c", constraints_path\) - - # Run py.test against the unit tests. - session.run\( - "py.test", - "--quiet", - f"--junitxml={os.path.split\(tests_path\)[-1]}_{session.python}_sponge_log.xml", - "--cov=db_dtypes", - "--cov=tests/unit", - "--cov-append", - "--cov-config=.coveragerc", - "--cov-report=", - "--cov-fail-under=0", - tests_path, - *session.posargs, - \) - - @nox.session\(python=UNIT_TEST_PYTHON_VERSIONS\) def unit\(session\): """Run the unit test suite.""" default\(session\) ''', r''' -def default(session, tests_path): - # Install all test dependencies, then install this package in-place. - - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) - - # Run py.test against the unit tests. - session.run( - "py.test", - "--quiet", - f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml", - "--cov=db_dtypes", - "--cov=tests/unit", - "--cov-append", - "--cov-config=.coveragerc", - "--cov-report=", - "--cov-fail-under=0", - tests_path, - *session.posargs, - ) - - def prerelease(session, tests_path): constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" From 24a6e2c86118a4f070bdfce61a1e6d0b2b4ecb0c Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 25 Mar 2022 13:34:16 -0500 Subject: [PATCH 4/5] try again without backslash --- owlbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index 64edf0c..383ae37 100644 --- a/owlbot.py +++ b/owlbot.py @@ -84,7 +84,7 @@ s.replace( ["noxfile.py"], r'f"--junitxml=unit_{session.python}_sponge_log.xml",', - r'f"--junitxml={os.path.split\(tests_path\)[-1]}_{session.python}_sponge_log.xml",', + r'f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml",', ) s.replace( ["noxfile.py"], From 4fca1e49049f8a2310c67e34d76e5beaf2ea65c1 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 25 Mar 2022 18:36:28 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 98b45ab..0ab6290 100644 --- a/noxfile.py +++ b/noxfile.py @@ -103,7 +103,7 @@ def default(session, tests_path): session.run( "py.test", "--quiet", - f"--junitxml=unit_{session.python}_sponge_log.xml", + f"--junitxml={os.path.split(tests_path)[-1]}_{session.python}_sponge_log.xml", "--cov=db_dtypes", "--cov=tests/unit", "--cov-append", @@ -115,10 +115,104 @@ def default(session, tests_path): ) +def prerelease(session, tests_path): + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + + # PyArrow prerelease packages are published to an alternative PyPI host. + # https://arrow.apache.org/docs/python/install.html#installing-nightly-packages + session.install( + "--extra-index-url", + "https://pypi.fury.io/arrow-nightlies/", + "--prefer-binary", + "--pre", + "--upgrade", + "pyarrow", + ) + session.install( + "--extra-index-url", + "https://pypi.anaconda.org/scipy-wheels-nightly/simple", + "--prefer-binary", + "--pre", + "--upgrade", + "pandas", + ) + session.install( + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", + "-c", + constraints_path, + ) + + # Because we test minimum dependency versions on the minimum Python + # version, the first version we test with in the unit tests sessions has a + # constraints file containing all dependencies and extras. + with open( + CURRENT_DIRECTORY + / "testing" + / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", + encoding="utf-8", + ) as constraints_file: + constraints_text = constraints_file.read() + + # Ignore leading whitespace and comment lines. + deps = [ + match.group(1) + for match in re.finditer( + r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE + ) + ] + + # We use --no-deps to ensure that pre-release versions aren't overwritten + # by the version ranges in setup.py. + session.install(*deps) + session.install("--no-deps", "-e", ".") + + # Print out prerelease package versions. + session.run("python", "-m", "pip", "freeze") + + # Run py.test against the unit tests. + session.run( + "py.test", + "--quiet", + f"--junitxml={os.path.split(tests_path)[-1]}_prerelease_{session.python}_sponge_log.xml", + "--cov=db_dtypes", + "--cov=tests/unit", + "--cov-append", + "--cov-config=.coveragerc", + "--cov-report=", + "--cov-fail-under=0", + tests_path, + *session.posargs, + ) + + +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) +def compliance(session): + """Run the compliance test suite.""" + default(session, os.path.join("tests", "compliance")) + + +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) +def compliance_prerelease(session): + """Run the compliance test suite with prerelease dependencies.""" + prerelease(session, os.path.join("tests", "compliance")) + + @nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" - default(session) + default(session, os.path.join("tests", "unit")) + + +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) +def unit_prerelease(session): + """Run the unit test suite with prerelease dependencies.""" + prerelease(session, os.path.join("tests", "unit")) @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)