From 3ee2fce31fdb153f1f63bacee9c6a88a8aa60db3 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 16 Mar 2021 08:32:18 -0700 Subject: [PATCH] Backport PR #40457: CI: fix failing script/tests --- Makefile | 5 ++++- scripts/__init__.py | 0 scripts/tests/test_inconsistent_namespace_check.py | 2 +- scripts/tests/test_validate_docstrings.py | 7 +++++-- scripts/tests/test_validate_unwanted_patterns.py | 3 ++- 5 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 scripts/__init__.py diff --git a/Makefile b/Makefile index 2c968234749f5..ae1b082626629 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY : develop build clean clean_pyc doc lint-diff black +.PHONY : develop build clean clean_pyc doc lint-diff black test-scripts all: develop @@ -38,3 +38,6 @@ check: --included-file-extensions="py" \ --excluded-file-paths=pandas/tests,asv_bench/,doc/ pandas/ + +test-scripts: + pytest scripts diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/scripts/tests/test_inconsistent_namespace_check.py b/scripts/tests/test_inconsistent_namespace_check.py index 37e6d288d9341..10cb3042dfacb 100644 --- a/scripts/tests/test_inconsistent_namespace_check.py +++ b/scripts/tests/test_inconsistent_namespace_check.py @@ -2,7 +2,7 @@ import pytest -from scripts.check_for_inconsistent_pandas_namespace import main +from ..check_for_inconsistent_pandas_namespace import main BAD_FILE_0 = "cat_0 = Categorical()\ncat_1 = pd.Categorical()" BAD_FILE_1 = "cat_0 = pd.Categorical()\ncat_1 = Categorical()" diff --git a/scripts/tests/test_validate_docstrings.py b/scripts/tests/test_validate_docstrings.py index 74819db7b878c..7e4c68ddc183b 100644 --- a/scripts/tests/test_validate_docstrings.py +++ b/scripts/tests/test_validate_docstrings.py @@ -2,7 +2,8 @@ import textwrap import pytest -import validate_docstrings + +from .. import validate_docstrings class BadDocstrings: @@ -162,7 +163,9 @@ def test_bad_class(self, capsys): ( "BadDocstrings", "indentation_is_not_a_multiple_of_four", - ("flake8 error: E111 indentation is not a multiple of four",), + # with flake8 3.9.0, the message ends with four spaces, + # whereas in earlier versions, it ended with "four" + ("flake8 error: E111 indentation is not a multiple of ",), ), ( "BadDocstrings", diff --git a/scripts/tests/test_validate_unwanted_patterns.py b/scripts/tests/test_validate_unwanted_patterns.py index 947666a730ee9..ef93fd1d21981 100644 --- a/scripts/tests/test_validate_unwanted_patterns.py +++ b/scripts/tests/test_validate_unwanted_patterns.py @@ -1,7 +1,8 @@ import io import pytest -import validate_unwanted_patterns + +from .. import validate_unwanted_patterns class TestBarePytestRaises: