Skip to content

Commit

Permalink
fix spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 29, 2023
1 parent bc1cc15 commit f94cdd1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 49 deletions.
14 changes: 8 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ repos:
hooks:
- id: check-github-workflows

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
- id: codespell
args: ["-L", "sur,nd"]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: ruff
args: ["--fix"]
args: ["--fix", "--show-fixes"]
- id: ruff-format
2 changes: 1 addition & 1 deletion docs/source/how_to_guides/write_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ by running `jupyter-releaser list-envvars`.

## Default Values, Options, Skip, and Hooks

The default values can also be overriden using a config file.
The default values can also be overridden using a config file.

Options can be overridden using the `options` section.

Expand Down
8 changes: 2 additions & 6 deletions jupyter_releaser/mock_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ async def create_a_release(owner: str, repo: str, request: Request) -> Release:


@app.patch("/repos/{owner}/{repo}/releases/{release_id}")
async def update_a_release(
owner: str, repo: str, release_id: int, request: Request
) -> Release:
async def update_a_release(owner: str, repo: str, release_id: int, request: Request) -> Release:
"""https://docs.github.com/en/rest/releases/releases#update-a-release"""
data = await request.json()
model = releases[str(release_id)]
Expand All @@ -184,9 +182,7 @@ async def update_a_release(


@app.post("/repos/{owner}/{repo}/releases/{release_id}/assets")
async def upload_a_release_asset(
owner: str, repo: str, release_id: int, request: Request
) -> None:
async def upload_a_release_asset(owner: str, repo: str, release_id: int, request: Request) -> None:
"""https://docs.github.com/en/rest/releases/assets#upload-a-release-asset"""
base_url = get_mock_github_url()
model = releases[str(release_id)]
Expand Down
2 changes: 1 addition & 1 deletion jupyter_releaser/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def run(*args, **kwargs):
if result.exit_code != 0:
if result.stderr_bytes:
print("Captured stderr\n", result.stderr, "\n\n")
print("Catpured stdout\n", result.stdout, "\n\n")
print("Captured stdout\n", result.stdout, "\n\n")
assert result.exception is not None
raise result.exception

Expand Down
48 changes: 13 additions & 35 deletions jupyter_releaser/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ def test_bump_version(npm_package, runner):
def test_bump_version_bad_version(py_package, runner):
runner(["prep-git", "--git-url", py_package])
with pytest.raises(CalledProcessError):
runner(
["bump-version", "--version-spec", "a1.0.1"], env=dict(GITHUB_ACTIONS="")
)
runner(["bump-version", "--version-spec", "a1.0.1"], env=dict(GITHUB_ACTIONS=""))


def test_bump_version_tag_exists(py_package, runner):
Expand Down Expand Up @@ -220,7 +218,7 @@ def test_build_changelog_existing(py_package, mocker, runner):
runner(["build-changelog", "--changelog-path", changelog_file])

text = changelog_path.read_text(encoding="utf-8")
text = text.replace("defining contributions", "Definining contributions")
text = text.replace("defining contributions", "Defining contributions")
changelog_path.write_text(text, encoding="utf-8")

# Commit the change
Expand All @@ -230,7 +228,7 @@ def test_build_changelog_existing(py_package, mocker, runner):
runner(["build-changelog", "--changelog-path", changelog_file])

text = changelog_path.read_text(encoding="utf-8")
assert "Definining contributions" in text, text
assert "Defining contributions" in text, text
assert "defining contributions" not in text, text

assert len(re.findall(changelog.START_MARKER, text)) == 1
Expand Down Expand Up @@ -343,9 +341,7 @@ def test_draft_changelog_dry_run(npm_package, mocker, runner, git_prep):
del os.environ["RH_SINCE_LAST_STABLE"]


def test_draft_changelog_lerna(
workspace_package, mocker, runner, mock_github, git_prep
):
def test_draft_changelog_lerna(workspace_package, mocker, runner, mock_github, git_prep):
mock_changelog_entry(workspace_package, runner, mocker)
runner(["draft-changelog", "--version-spec", VERSION_SPEC])

Expand Down Expand Up @@ -382,9 +378,7 @@ def test_check_python_different_names(
monkeypatch.setenv("RH_CHECK_IMPORTS", "foobar")


def test_check_python_resource_path(
monkeypatch, py_package, runner, build_mock, git_prep
):
def test_check_python_resource_path(monkeypatch, py_package, runner, build_mock, git_prep):
monkeypatch.setenv("RH_PYDIST_RESOURCE_PATHS", "foo/bar/baz.txt")

# Convert the package to use a package dir.
Expand Down Expand Up @@ -522,9 +516,7 @@ def test_extract_dist_py(py_package, runner, mocker, mock_github, tmp_path, git_
os.name == "nt" and sys.version_info < (3, 8),
reason="See https://bugs.python.org/issue26660",
)
def test_extract_dist_multipy(
py_multipackage, runner, mocker, mock_github, tmp_path, git_prep
):
def test_extract_dist_multipy(py_multipackage, runner, mocker, mock_github, tmp_path, git_prep):
git_repo = py_multipackage[0]["abs_path"]
changelog_entry = mock_changelog_entry(git_repo, runner, mocker)

Expand Down Expand Up @@ -572,9 +564,7 @@ def test_extract_dist_npm(npm_dist, runner, mocker, mock_github, tmp_path):
assert "after-extract-release" in log


@pytest.mark.skipif(
os.name == "nt", reason="pypiserver does not start properly on Windows"
)
@pytest.mark.skipif(os.name == "nt", reason="pypiserver does not start properly on Windows")
def test_publish_assets_py(py_package, runner, mocker, git_prep, mock_github):
# Create the dist files
changelog_entry = mock_changelog_entry(py_package, runner, mocker)
Expand Down Expand Up @@ -622,15 +612,11 @@ def wrapped(cmd, **kwargs):

mock_run = mocker.patch("jupyter_releaser.util.run", wraps=wrapped)

runner(
["publish-assets", "--npm-cmd", "npm publish --dry-run", "--dist-dir", dist_dir]
)
runner(["publish-assets", "--npm-cmd", "npm publish --dry-run", "--dist-dir", dist_dir])
assert called == 3, called


def test_publish_assets_npm_exists(
npm_dist, runner, mocker, mock_github, draft_release
):
def test_publish_assets_npm_exists(npm_dist, runner, mocker, mock_github, draft_release):
os.environ["RH_RELEASE_URL"] = draft_release
dist_dir = npm_dist / util.CHECKOUT_NAME / "dist"
called = 0
Expand Down Expand Up @@ -660,9 +646,7 @@ def wrapped(cmd, **kwargs):
assert called == 3, called


def test_publish_assets_npm_all_exists(
npm_dist, runner, mocker, mock_github, draft_release
):
def test_publish_assets_npm_all_exists(npm_dist, runner, mocker, mock_github, draft_release):
os.environ["RH_RELEASE_URL"] = draft_release
dist_dir = npm_dist / util.CHECKOUT_NAME / "dist"
called = 0
Expand Down Expand Up @@ -769,9 +753,7 @@ def wrapped(cmd, **kwargs):
assert "after-build-python" in log


def test_forwardport_changelog_no_new(
npm_package, runner, mocker, mock_github, git_prep
):
def test_forwardport_changelog_no_new(npm_package, runner, mocker, mock_github, git_prep):
release = create_draft_release("bar")
os.environ["RH_RELEASE_URL"] = release.html_url

Expand All @@ -790,9 +772,7 @@ def test_forwardport_changelog_no_new(
assert "after-forwardport-changelog" in log


def test_forwardport_changelog_has_new(
npm_package, runner, mocker, mock_github, git_prep
):
def test_forwardport_changelog_has_new(npm_package, runner, mocker, mock_github, git_prep):
release = create_draft_release("bar")
os.environ["RH_RELEASE_URL"] = release.html_url

Expand All @@ -803,9 +783,7 @@ def test_forwardport_changelog_has_new(
util.run("git push origin backport_branch", cwd=util.CHECKOUT_NAME)
util.run(f"git checkout {current}")
mock_changelog_entry(npm_package, runner, mocker)
util.run(
f'git commit -a -m "Add changelog entry {VERSION_SPEC}"', cwd=util.CHECKOUT_NAME
)
util.run(f'git commit -a -m "Add changelog entry {VERSION_SPEC}"', cwd=util.CHECKOUT_NAME)
util.run(f"git tag v{VERSION_SPEC}", cwd=util.CHECKOUT_NAME)
util.run(f"git checkout {current}", cwd=util.CHECKOUT_NAME)
util.run("git push origin backport_branch --tags", cwd=util.CHECKOUT_NAME)
Expand Down

0 comments on commit f94cdd1

Please sign in to comment.