From e772738225ade7f604b87511decd72f3a10e21f4 Mon Sep 17 00:00:00 2001 From: Eleanor Boyd Date: Thu, 9 Jan 2025 14:18:16 -0800 Subject: [PATCH] remove stale PR check (#24708) The script isn't working and seems to not be worth the effort --- .github/workflows/stale-prs.yml | 51 ------------------- .../tests/pytestadapter/test_discovery.py | 40 +++++++++------ .../tests/pytestadapter/test_execution.py | 12 ++--- .../tests/unittestadapter/test_discovery.py | 6 +-- 4 files changed, 33 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/stale-prs.yml diff --git a/.github/workflows/stale-prs.yml b/.github/workflows/stale-prs.yml deleted file mode 100644 index e3a2d8600159..000000000000 --- a/.github/workflows/stale-prs.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Warn about month-old PRs - -on: - schedule: - - cron: '0 0 */2 * *' # Runs every other day at midnight - -jobs: - stale-prs: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Warn about stale PRs - uses: actions/github-script@v7 - with: - script: | - const { Octokit } = require("@octokit/rest"); - const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); - - const owner = context.repo.owner; - const repo = context.repo.repo; - const staleTime = new Date(); - staleTime.setMonth(staleTime.getMonth() - 1); - - const prs = await octokit.pulls.list({ - owner, - repo, - state: 'open' - }); - - for (const pr of prs.data) { - const comments = await octokit.issues.listComments({ - owner, - repo, - issue_number: pr.number - }); - - const lastComment = comments.data.length > 0 ? new Date(comments.data[comments.data.length - 1].created_at) : new Date(pr.created_at); - - if (lastComment < staleTime) { - await octokit.issues.createComment({ - owner, - repo, - issue_number: pr.number, - body: 'This PR has been stale for over a month. Please update or close it.' - }); - } - } - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/python_files/tests/pytestadapter/test_discovery.py b/python_files/tests/pytestadapter/test_discovery.py index a0ba9c289864..4f9fe3eb19ac 100644 --- a/python_files/tests/pytestadapter/test_discovery.py +++ b/python_files/tests/pytestadapter/test_discovery.py @@ -195,15 +195,17 @@ def test_pytest_collect(file, expected_const): if actual_list is not None: actual_item = actual_list.pop(0) assert all(item in actual_item for item in ("status", "cwd", "error")) - assert ( - actual_item.get("status") == "success" - ), f"Status is not 'success', error is: {actual_item.get('error')}" + assert actual_item.get("status") == "success", ( + f"Status is not 'success', error is: {actual_item.get('error')}" + ) assert actual_item.get("cwd") == os.fspath(helpers.TEST_DATA_PATH) assert is_same_tree( actual_item.get("tests"), expected_const, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_const, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_const, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) @pytest.mark.skipif( @@ -232,13 +234,13 @@ def test_symlink_root_dir(): actual_item = actual_list.pop(0) try: # Check if all requirements - assert all( - item in actual_item for item in ("status", "cwd", "error") - ), "Required keys are missing" + assert all(item in actual_item for item in ("status", "cwd", "error")), ( + "Required keys are missing" + ) assert actual_item.get("status") == "success", "Status is not 'success'" - assert actual_item.get("cwd") == os.fspath( - destination - ), f"CWD does not match: {os.fspath(destination)}" + assert actual_item.get("cwd") == os.fspath(destination), ( + f"CWD does not match: {os.fspath(destination)}" + ) assert actual_item.get("tests") == expected, "Tests do not match expected value" except AssertionError as e: # Print the actual_item in JSON format if an assertion fails @@ -271,7 +273,9 @@ def test_pytest_root_dir(): actual_item.get("tests"), expected_discovery_test_output.root_with_config_expected_output, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) def test_pytest_config_file(): @@ -298,7 +302,9 @@ def test_pytest_config_file(): actual_item.get("tests"), expected_discovery_test_output.root_with_config_expected_output, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) def test_config_sub_folder(): @@ -347,12 +353,14 @@ def test_ruff_plugin(): if actual_list is not None: actual_item = actual_list.pop(0) assert all(item in actual_item for item in ("status", "cwd", "error")) - assert ( - actual_item.get("status") == "success" - ), f"Status is not 'success', error is: {actual_item.get('error')}" + assert actual_item.get("status") == "success", ( + f"Status is not 'success', error is: {actual_item.get('error')}" + ) assert actual_item.get("cwd") == os.fspath(helpers.TEST_DATA_PATH) assert is_same_tree( actual_item.get("tests"), expected_discovery_test_output.ruff_test_expected_output, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.ruff_test_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.ruff_test_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) diff --git a/python_files/tests/pytestadapter/test_execution.py b/python_files/tests/pytestadapter/test_execution.py index 27fd1160441b..95a66e0e7b87 100644 --- a/python_files/tests/pytestadapter/test_execution.py +++ b/python_files/tests/pytestadapter/test_execution.py @@ -258,13 +258,13 @@ def test_symlink_run(): actual_item = actual_list.pop(0) try: # Check if all requirements - assert all( - item in actual_item for item in ("status", "cwd", "result") - ), "Required keys are missing" + assert all(item in actual_item for item in ("status", "cwd", "result")), ( + "Required keys are missing" + ) assert actual_item.get("status") == "success", "Status is not 'success'" - assert actual_item.get("cwd") == os.fspath( - destination - ), f"CWD does not match: {os.fspath(destination)}" + assert actual_item.get("cwd") == os.fspath(destination), ( + f"CWD does not match: {os.fspath(destination)}" + ) actual_result_dict = {} actual_result_dict.update(actual_item["result"]) assert actual_result_dict == expected_const diff --git a/python_files/tests/unittestadapter/test_discovery.py b/python_files/tests/unittestadapter/test_discovery.py index 972556de999b..a10b5c406680 100644 --- a/python_files/tests/unittestadapter/test_discovery.py +++ b/python_files/tests/unittestadapter/test_discovery.py @@ -314,9 +314,9 @@ def test_simple_django_collect(): if actual_list is not None: actual_item = actual_list.pop(0) assert all(item in actual_item for item in ("status", "cwd")) - assert ( - actual_item.get("status") == "success" - ), f"Status is not 'success', error is: {actual_item.get('error')}" + assert actual_item.get("status") == "success", ( + f"Status is not 'success', error is: {actual_item.get('error')}" + ) assert actual_item.get("cwd") == os.fspath(data_path) assert len(actual_item["tests"]["children"]) == 1 assert actual_item["tests"]["children"][0]["children"][0]["id_"] == os.fsdecode(