Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions async_subprocess.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""asyncio subprocess create_subprocess_exec"""

import asyncio
import subprocess

Expand Down
1 change: 1 addition & 0 deletions async_subprocess_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for async_subprocess_test"""

import subprocess

import pytest
Expand Down
1 change: 1 addition & 0 deletions bot_local_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Make sure bot_local works"""

import pytest

from bot_local import async_main
Expand Down
37 changes: 21 additions & 16 deletions bot_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Doof"""

import asyncio
from datetime import timedelta

Expand Down Expand Up @@ -1045,13 +1046,15 @@ async def test_wait_for_checkboxes(
get_release_pr_mock = mocker.async_patch("bot.get_release_pr", return_value=pr)
get_unchecked_patch = mocker.async_patch(
"bot.get_unchecked_authors",
side_effect=[
{"author1", "author2", "author3"},
{"author2"},
set(),
]
if has_checkboxes
else [set()],
side_effect=(
[
{"author1", "author2", "author3"},
{"author2"},
set(),
]
if has_checkboxes
else [set()]
),
)
doof.slack_users = [
{"profile": {"real_name": name}, "id": username}
Expand Down Expand Up @@ -1403,15 +1406,17 @@ async def test_start_new_releases(
)
get_release_pr_mock = mocker.async_patch(
"bot.get_release_pr",
return_value=ReleasePR(
version=old_version,
url="https://example.com",
body="...",
number=123,
open=False,
)
if has_release_pr
else None,
return_value=(
ReleasePR(
version=old_version,
url="https://example.com",
body="...",
number=123,
open=False,
)
if has_release_pr
else None
),
)
release_notes = f"Release notes for {test_repo.repo_url}"
get_project_version_mock = mocker.async_patch(
Expand Down
1 change: 1 addition & 0 deletions client_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper for HTTP client. Replaces httpx until it matures."""

import requests
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
Expand Down
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures for tests"""

import os

import pytest
Expand Down
1 change: 1 addition & 0 deletions constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants"""

import os


Expand Down
1 change: 1 addition & 0 deletions exception.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exceptions for release script"""

from subprocess import CalledProcessError


Expand Down
1 change: 1 addition & 0 deletions finish_release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Release script to finish the release"""

import os
import re
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions finish_release_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for finish_release.py"""

from datetime import datetime
import re
import os
Expand Down
1 change: 1 addition & 0 deletions github_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for github functions"""

import json
import os
from urllib.parse import quote
Expand Down
1 change: 1 addition & 0 deletions lib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Shared functions for release script Python files"""

from collections import namedtuple
from contextlib import asynccontextmanager
from datetime import datetime, timezone
Expand Down
1 change: 1 addition & 0 deletions lib_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for lib"""

from requests import Response, HTTPError
import pytest

Expand Down
1 change: 1 addition & 0 deletions publish.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for publishing"""

import os
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions publish_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test package uploading functions
"""

import os
from pathlib import Path
import subprocess
Expand Down
1 change: 1 addition & 0 deletions release_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for release script"""

import os
from subprocess import CalledProcessError

Expand Down
1 change: 1 addition & 0 deletions repo_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Information about repositories"""

from collections import namedtuple

RepoInfo = namedtuple(
Expand Down
1 change: 1 addition & 0 deletions slack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""functions for interacting with slack"""

from client_wrapper import ClientWrapper


Expand Down
1 change: 1 addition & 0 deletions slack_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for slack functions"""

import pytest


Expand Down
9 changes: 6 additions & 3 deletions status.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Get release status of a repository"""

from constants import (
BLOCKER_LABELS,
DEPLOYED_TO_PROD,
Expand Down Expand Up @@ -89,9 +90,11 @@ async def status_for_repo_new_commits(*, github_access_token, repo_info, release
)
default_branch = await get_default_branch(working_dir)
return await any_commits_between_branches(
branch1="origin/release-candidate"
if release_pr and release_pr.open
else f"v{last_version}",
branch1=(
"origin/release-candidate"
if release_pr and release_pr.open
else f"v{last_version}"
),
branch2=default_branch,
root=working_dir,
)
Expand Down
9 changes: 6 additions & 3 deletions status_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for statuses"""

import pytest


Expand Down Expand Up @@ -159,9 +160,11 @@ async def test_status_for_repo_new_commits( # pylint: disable=too-many-argument
)
get_default_branch_mock.assert_called_once_with(test_repo_directory)
any_commits_mock.assert_called_once_with(
branch1="origin/release-candidate"
if has_release_pr and is_open
else f"v{get_project_version_mock.return_value}",
branch1=(
"origin/release-candidate"
if has_release_pr and is_open
else f"v{get_project_version_mock.return_value}"
),
branch2=get_default_branch_mock.return_value,
root=test_repo_directory,
)
1 change: 0 additions & 1 deletion test_constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Constants used in unit test"""


FAKE_RELEASE_PR_BODY = """
## Alice Pote
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==22.3.0
black==25.1.0
codecov
pdbpp
pylint
Expand Down
1 change: 1 addition & 0 deletions test_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for testing"""

from contextlib import asynccontextmanager, contextmanager
import gzip
import os
Expand Down
1 change: 1 addition & 0 deletions version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
General versioning functions
"""

import json
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions version_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test version functions"""

import json
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions wait_for_deploy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wait for hash on server to match with deployed code"""

import asyncio
import time

Expand Down
1 change: 1 addition & 0 deletions wait_for_deploy_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for wait_for_deploy"""

import pytest

from test_util import async_context_manager_yielder
Expand Down
1 change: 1 addition & 0 deletions web.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Web server for handling slack webhooks
"""

import hmac
import json

Expand Down
1 change: 1 addition & 0 deletions web_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the web server"""

import asyncio
import json
from unittest.mock import patch
Expand Down