apdev 0.2.6__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apdev-0.2.6 → apdev-0.2.7}/PKG-INFO +28 -1
- {apdev-0.2.6 → apdev-0.2.7}/README.md +27 -0
- {apdev-0.2.6 → apdev-0.2.7}/pyproject.toml +1 -1
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/__init__.py +1 -1
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/cli.py +14 -1
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/release.sh +70 -4
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev.egg-info/PKG-INFO +28 -1
- {apdev-0.2.6 → apdev-0.2.7}/tests/test_cli.py +61 -0
- {apdev-0.2.6 → apdev-0.2.7}/setup.cfg +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/__main__.py +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/charsets/base.json +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/charsets/chinese.json +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/charsets/japanese.json +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/charsets/korean.json +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/check_chars.py +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/check_imports.py +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/config.py +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev/py.typed +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev.egg-info/SOURCES.txt +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev.egg-info/dependency_links.txt +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev.egg-info/entry_points.txt +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev.egg-info/requires.txt +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/src/apdev.egg-info/top_level.txt +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/tests/test_check_chars.py +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/tests/test_check_imports.py +0 -0
- {apdev-0.2.6 → apdev-0.2.7}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apdev
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Shared development tools for Python projects - character validation, circular import detection, and more
|
|
5
5
|
Author-email: aiperceivable <tercel.yi@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -98,6 +98,10 @@ apdev release 0.2.0
|
|
|
98
98
|
# Upload to a named .pypirc section (default: [tool.apdev] pypi_repository, or "pypi")
|
|
99
99
|
apdev release --repository reachreel
|
|
100
100
|
apdev release -r testpypi 0.3.0
|
|
101
|
+
|
|
102
|
+
# Publish the GitHub release as another account (default: [tool.apdev] github_account, or gh's active account)
|
|
103
|
+
apdev release --account wilfred
|
|
104
|
+
apdev release -a tercel 0.3.0
|
|
101
105
|
```
|
|
102
106
|
|
|
103
107
|
The command provides an interactive menu with steps:
|
|
@@ -137,6 +141,28 @@ username = __token__
|
|
|
137
141
|
password = pypi-B... # account B
|
|
138
142
|
```
|
|
139
143
|
|
|
144
|
+
### Releasing with a second GitHub account
|
|
145
|
+
|
|
146
|
+
`git push` already follows the remote (for example an SSH alias per account),
|
|
147
|
+
but `gh` uses one active login. Log the second account in once — `gh` keeps
|
|
148
|
+
several accounts per host — and let the repository choose which one releases:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
gh auth login --git-protocol ssh # first account
|
|
152
|
+
gh auth login --git-protocol ssh # second account, same host
|
|
153
|
+
gh auth status # both logins listed, one active
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```toml
|
|
157
|
+
[tool.apdev]
|
|
158
|
+
github_account = "wilfred"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`apdev release` then resolves that account's token with
|
|
162
|
+
`gh auth token --user wilfred`, exports it as `GH_TOKEN`/`GITHUB_TOKEN` for the
|
|
163
|
+
run only, and prints `GitHub user: wilfred` in the header. The global active
|
|
164
|
+
account is never switched, so other repositories keep their own identity.
|
|
165
|
+
|
|
140
166
|
Override auto-detection with environment variables:
|
|
141
167
|
|
|
142
168
|
```bash
|
|
@@ -152,6 +178,7 @@ Add to your project's `pyproject.toml` so commands can run without CLI arguments
|
|
|
152
178
|
base_package = "mypackage" # Required by check-imports
|
|
153
179
|
src_dir = "src" # Source directory (default: "src")
|
|
154
180
|
pypi_repository = "mypackage" # .pypirc section for `apdev release` (default: "pypi")
|
|
181
|
+
github_account = "wilfred" # gh login for the GitHub release (default: gh's active account)
|
|
155
182
|
```
|
|
156
183
|
|
|
157
184
|
With this config, the commands work out of the box:
|
|
@@ -68,6 +68,10 @@ apdev release 0.2.0
|
|
|
68
68
|
# Upload to a named .pypirc section (default: [tool.apdev] pypi_repository, or "pypi")
|
|
69
69
|
apdev release --repository reachreel
|
|
70
70
|
apdev release -r testpypi 0.3.0
|
|
71
|
+
|
|
72
|
+
# Publish the GitHub release as another account (default: [tool.apdev] github_account, or gh's active account)
|
|
73
|
+
apdev release --account wilfred
|
|
74
|
+
apdev release -a tercel 0.3.0
|
|
71
75
|
```
|
|
72
76
|
|
|
73
77
|
The command provides an interactive menu with steps:
|
|
@@ -107,6 +111,28 @@ username = __token__
|
|
|
107
111
|
password = pypi-B... # account B
|
|
108
112
|
```
|
|
109
113
|
|
|
114
|
+
### Releasing with a second GitHub account
|
|
115
|
+
|
|
116
|
+
`git push` already follows the remote (for example an SSH alias per account),
|
|
117
|
+
but `gh` uses one active login. Log the second account in once — `gh` keeps
|
|
118
|
+
several accounts per host — and let the repository choose which one releases:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
gh auth login --git-protocol ssh # first account
|
|
122
|
+
gh auth login --git-protocol ssh # second account, same host
|
|
123
|
+
gh auth status # both logins listed, one active
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```toml
|
|
127
|
+
[tool.apdev]
|
|
128
|
+
github_account = "wilfred"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`apdev release` then resolves that account's token with
|
|
132
|
+
`gh auth token --user wilfred`, exports it as `GH_TOKEN`/`GITHUB_TOKEN` for the
|
|
133
|
+
run only, and prints `GitHub user: wilfred` in the header. The global active
|
|
134
|
+
account is never switched, so other repositories keep their own identity.
|
|
135
|
+
|
|
110
136
|
Override auto-detection with environment variables:
|
|
111
137
|
|
|
112
138
|
```bash
|
|
@@ -122,6 +148,7 @@ Add to your project's `pyproject.toml` so commands can run without CLI arguments
|
|
|
122
148
|
base_package = "mypackage" # Required by check-imports
|
|
123
149
|
src_dir = "src" # Source directory (default: "src")
|
|
124
150
|
pypi_repository = "mypackage" # .pypirc section for `apdev release` (default: "pypi")
|
|
151
|
+
github_account = "wilfred" # gh login for the GitHub release (default: gh's active account)
|
|
125
152
|
```
|
|
126
153
|
|
|
127
154
|
With this config, the commands work out of the box:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "apdev"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.7"
|
|
8
8
|
description = "Shared development tools for Python projects - character validation, circular import detection, and more"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "Apache-2.0"}
|
|
@@ -85,6 +85,15 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
85
85
|
action="store_true",
|
|
86
86
|
help="Auto-accept all defaults (silent mode)",
|
|
87
87
|
)
|
|
88
|
+
release_parser.add_argument(
|
|
89
|
+
"--account",
|
|
90
|
+
"-a",
|
|
91
|
+
dest="account",
|
|
92
|
+
help=(
|
|
93
|
+
"GitHub account (gh login) used to publish the release "
|
|
94
|
+
"(default: [tool.apdev] github_account, or gh's active account)"
|
|
95
|
+
),
|
|
96
|
+
)
|
|
88
97
|
release_parser.add_argument(
|
|
89
98
|
"--repository",
|
|
90
99
|
"-r",
|
|
@@ -157,9 +166,13 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
157
166
|
cmd = ["bash", str(script)]
|
|
158
167
|
if args.yes:
|
|
159
168
|
cmd.append("--yes")
|
|
160
|
-
|
|
169
|
+
config = load_config()
|
|
170
|
+
repository = args.repository or config.get("pypi_repository")
|
|
161
171
|
if repository:
|
|
162
172
|
cmd.extend(["--repository", str(repository)])
|
|
173
|
+
account = args.account or config.get("github_account")
|
|
174
|
+
if account:
|
|
175
|
+
cmd.extend(["--account", str(account)])
|
|
163
176
|
if args.version:
|
|
164
177
|
cmd.append(args.version)
|
|
165
178
|
release_env = os.environ.copy()
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
#
|
|
8
8
|
# Auto-detects project name from pyproject.toml and GitHub repo from git remote.
|
|
9
9
|
# Override with environment variables: PROJECT_NAME, PACKAGE_NAME, GITHUB_REPO,
|
|
10
|
-
# PYPI_REPOSITORY (named .pypirc section, default "pypi")
|
|
10
|
+
# PYPI_REPOSITORY (named .pypirc section, default "pypi"), GITHUB_ACCOUNT
|
|
11
|
+
# (gh login to publish the GitHub release as; default: gh's active account).
|
|
11
12
|
|
|
12
13
|
# Note: set -e is disabled to allow step-by-step execution
|
|
13
14
|
# Individual steps will handle their own error handling
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
# Silent mode flag (--yes or -y to auto-accept all defaults)
|
|
16
17
|
SILENT=false
|
|
17
18
|
PYPI_REPOSITORY="${PYPI_REPOSITORY:-}"
|
|
19
|
+
GITHUB_ACCOUNT="${GITHUB_ACCOUNT:-}"
|
|
18
20
|
POSITIONAL_ARGS=()
|
|
19
21
|
while [ "$#" -gt 0 ]; do
|
|
20
22
|
case "$1" in
|
|
@@ -30,6 +32,17 @@ while [ "$#" -gt 0 ]; do
|
|
|
30
32
|
--repository=*)
|
|
31
33
|
PYPI_REPOSITORY="${1#*=}"
|
|
32
34
|
;;
|
|
35
|
+
--account|-a)
|
|
36
|
+
if [ "$#" -lt 2 ] || [ -z "$2" ]; then
|
|
37
|
+
echo "Error: --account needs a GitHub login" >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
GITHUB_ACCOUNT="$2"
|
|
41
|
+
shift
|
|
42
|
+
;;
|
|
43
|
+
--account=*)
|
|
44
|
+
GITHUB_ACCOUNT="${1#*=}"
|
|
45
|
+
;;
|
|
33
46
|
*) POSITIONAL_ARGS+=("$1") ;;
|
|
34
47
|
esac
|
|
35
48
|
shift
|
|
@@ -63,8 +76,18 @@ fi
|
|
|
63
76
|
if [ -z "$GITHUB_REPO" ]; then
|
|
64
77
|
REMOTE_URL=$(git remote get-url origin 2>/dev/null)
|
|
65
78
|
if [ -n "$REMOTE_URL" ]; then
|
|
66
|
-
# Extract owner/repo from
|
|
67
|
-
|
|
79
|
+
# Extract owner/repo from any remote form, including per-account SSH
|
|
80
|
+
# aliases such as git@github-work:owner/repo.git, which earlier versions
|
|
81
|
+
# did not recognise (they only matched github.com).
|
|
82
|
+
GITHUB_REPO=$(echo "$REMOTE_URL" \
|
|
83
|
+
| sed -E 's|\.git$||; s|/+$||' \
|
|
84
|
+
| tr ':' '/' \
|
|
85
|
+
| awk -F/ '{ if (NF >= 2) print $(NF-1) "/" $NF }')
|
|
86
|
+
if ! echo "$GITHUB_REPO" | grep -Eq '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$'; then
|
|
87
|
+
echo -e "${YELLOW}Warning: could not parse owner/repo from ${REMOTE_URL}${NC}"
|
|
88
|
+
echo -e "${YELLOW} Set GITHUB_REPO=owner/repo to create the GitHub release${NC}"
|
|
89
|
+
GITHUB_REPO=""
|
|
90
|
+
fi
|
|
68
91
|
fi
|
|
69
92
|
if [ -z "$GITHUB_REPO" ]; then
|
|
70
93
|
echo -e "${YELLOW}Warning: Could not detect GitHub repo from git remote${NC}"
|
|
@@ -91,6 +114,43 @@ if [ -z "$PYPI_REPOSITORY" ] && [ -f pyproject.toml ]; then
|
|
|
91
114
|
fi
|
|
92
115
|
PYPI_REPOSITORY="${PYPI_REPOSITORY:-pypi}"
|
|
93
116
|
|
|
117
|
+
# GitHub account: --account, then GITHUB_ACCOUNT, then [tool.apdev]
|
|
118
|
+
# github_account, then whatever `gh` has active. When set, its token is exported
|
|
119
|
+
# for this run only, so `gh` and the API fallback act as that user without
|
|
120
|
+
# touching the global `gh auth switch` state.
|
|
121
|
+
if [ -z "$GITHUB_ACCOUNT" ] && [ -f pyproject.toml ]; then
|
|
122
|
+
GITHUB_ACCOUNT=$(awk '
|
|
123
|
+
/^[[:space:]]*\[/ {
|
|
124
|
+
in_apdev = ($0 ~ /^[[:space:]]*\[tool\.apdev\][[:space:]]*$/)
|
|
125
|
+
next
|
|
126
|
+
}
|
|
127
|
+
in_apdev && /^[[:space:]]*github_account[[:space:]]*=/ {
|
|
128
|
+
print
|
|
129
|
+
exit
|
|
130
|
+
}
|
|
131
|
+
' pyproject.toml | sed -E 's/^[^=]*=[[:space:]]*//; s/[[:space:]]+$//; s/^"//; s/"$//; s/^\x27//; s/\x27$//')
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
if [ -n "$GITHUB_ACCOUNT" ]; then
|
|
135
|
+
if ! command -v gh > /dev/null 2>&1; then
|
|
136
|
+
echo -e "${RED}Error: --account/GITHUB_ACCOUNT needs the GitHub CLI${NC}"
|
|
137
|
+
echo -e "${YELLOW}Install it (brew install gh) or unset the account to use GITHUB_TOKEN${NC}"
|
|
138
|
+
exit 1
|
|
139
|
+
fi
|
|
140
|
+
if ! GH_ACCOUNT_TOKEN=$(gh auth token --user "$GITHUB_ACCOUNT" 2>/dev/null) || [ -z "$GH_ACCOUNT_TOKEN" ]; then
|
|
141
|
+
echo -e "${RED}Error: GitHub account '${GITHUB_ACCOUNT}' is not logged in${NC}"
|
|
142
|
+
echo -e "${YELLOW}Add it once with: gh auth login --git-protocol ssh${NC}"
|
|
143
|
+
echo -e "${YELLOW}Then verify with: gh auth status${NC}"
|
|
144
|
+
exit 1
|
|
145
|
+
fi
|
|
146
|
+
if [ -n "$GITHUB_TOKEN" ] && [ "$GITHUB_TOKEN" != "$GH_ACCOUNT_TOKEN" ]; then
|
|
147
|
+
echo -e "${YELLOW}Note: GITHUB_TOKEN was set; using the token of '${GITHUB_ACCOUNT}' instead${NC}"
|
|
148
|
+
fi
|
|
149
|
+
GH_TOKEN="$GH_ACCOUNT_TOKEN"
|
|
150
|
+
GITHUB_TOKEN="$GH_ACCOUNT_TOKEN"
|
|
151
|
+
export GH_TOKEN GITHUB_TOKEN
|
|
152
|
+
fi
|
|
153
|
+
|
|
94
154
|
# Get version from argument or pyproject.toml
|
|
95
155
|
if [ -z "$1" ]; then
|
|
96
156
|
VERSION=$(grep -E '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
|
@@ -111,6 +171,7 @@ echo -e "${CYAN}╚════════════════════
|
|
|
111
171
|
echo -e " Project: ${CYAN}${PROJECT_NAME}${NC}"
|
|
112
172
|
[ -n "$GITHUB_REPO" ] && echo -e " GitHub: ${CYAN}${GITHUB_REPO}${NC}"
|
|
113
173
|
echo -e " PyPI: ${CYAN}${PYPI_REPOSITORY}${NC}"
|
|
174
|
+
[ -n "$GITHUB_ACCOUNT" ] && echo -e " GitHub user: ${CYAN}${GITHUB_ACCOUNT}${NC}"
|
|
114
175
|
echo ""
|
|
115
176
|
|
|
116
177
|
# Function to check if step is already done
|
|
@@ -473,11 +534,16 @@ step6_git_tag() {
|
|
|
473
534
|
|
|
474
535
|
# Function to get GitHub token from various sources
|
|
475
536
|
get_github_token() {
|
|
476
|
-
# 1. Check environment variable
|
|
537
|
+
# 1. Check environment variable. GH_TOKEN comes first for the account
|
|
538
|
+
# selected by --account/GITHUB_ACCOUNT, which step 6.5 does not clear.
|
|
477
539
|
if [ -n "$GITHUB_TOKEN" ]; then
|
|
478
540
|
echo "$GITHUB_TOKEN"
|
|
479
541
|
return 0
|
|
480
542
|
fi
|
|
543
|
+
if [ -n "$GH_TOKEN" ]; then
|
|
544
|
+
echo "$GH_TOKEN"
|
|
545
|
+
return 0
|
|
546
|
+
fi
|
|
481
547
|
|
|
482
548
|
# 2. Check git config for token
|
|
483
549
|
local token=$(git config --global github.token 2>/dev/null || git config github.token 2>/dev/null)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apdev
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Shared development tools for Python projects - character validation, circular import detection, and more
|
|
5
5
|
Author-email: aiperceivable <tercel.yi@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -98,6 +98,10 @@ apdev release 0.2.0
|
|
|
98
98
|
# Upload to a named .pypirc section (default: [tool.apdev] pypi_repository, or "pypi")
|
|
99
99
|
apdev release --repository reachreel
|
|
100
100
|
apdev release -r testpypi 0.3.0
|
|
101
|
+
|
|
102
|
+
# Publish the GitHub release as another account (default: [tool.apdev] github_account, or gh's active account)
|
|
103
|
+
apdev release --account wilfred
|
|
104
|
+
apdev release -a tercel 0.3.0
|
|
101
105
|
```
|
|
102
106
|
|
|
103
107
|
The command provides an interactive menu with steps:
|
|
@@ -137,6 +141,28 @@ username = __token__
|
|
|
137
141
|
password = pypi-B... # account B
|
|
138
142
|
```
|
|
139
143
|
|
|
144
|
+
### Releasing with a second GitHub account
|
|
145
|
+
|
|
146
|
+
`git push` already follows the remote (for example an SSH alias per account),
|
|
147
|
+
but `gh` uses one active login. Log the second account in once — `gh` keeps
|
|
148
|
+
several accounts per host — and let the repository choose which one releases:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
gh auth login --git-protocol ssh # first account
|
|
152
|
+
gh auth login --git-protocol ssh # second account, same host
|
|
153
|
+
gh auth status # both logins listed, one active
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```toml
|
|
157
|
+
[tool.apdev]
|
|
158
|
+
github_account = "wilfred"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`apdev release` then resolves that account's token with
|
|
162
|
+
`gh auth token --user wilfred`, exports it as `GH_TOKEN`/`GITHUB_TOKEN` for the
|
|
163
|
+
run only, and prints `GitHub user: wilfred` in the header. The global active
|
|
164
|
+
account is never switched, so other repositories keep their own identity.
|
|
165
|
+
|
|
140
166
|
Override auto-detection with environment variables:
|
|
141
167
|
|
|
142
168
|
```bash
|
|
@@ -152,6 +178,7 @@ Add to your project's `pyproject.toml` so commands can run without CLI arguments
|
|
|
152
178
|
base_package = "mypackage" # Required by check-imports
|
|
153
179
|
src_dir = "src" # Source directory (default: "src")
|
|
154
180
|
pypi_repository = "mypackage" # .pypirc section for `apdev release` (default: "pypi")
|
|
181
|
+
github_account = "wilfred" # gh login for the GitHub release (default: gh's active account)
|
|
155
182
|
```
|
|
156
183
|
|
|
157
184
|
With this config, the commands work out of the box:
|
|
@@ -139,6 +139,67 @@ def test_cli_release_flag_beats_config(tmp_path: Path, monkeypatch: pytest.Monke
|
|
|
139
139
|
assert args[2:] == ["--repository", "testpypi"]
|
|
140
140
|
|
|
141
141
|
|
|
142
|
+
def test_cli_release_forwards_account_from_config(
|
|
143
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
144
|
+
) -> None:
|
|
145
|
+
"""[tool.apdev] github_account selects the gh login for the release."""
|
|
146
|
+
monkeypatch.chdir(tmp_path)
|
|
147
|
+
Path("pyproject.toml").write_text(
|
|
148
|
+
textwrap.dedent(
|
|
149
|
+
"""
|
|
150
|
+
[project]
|
|
151
|
+
name = "demo"
|
|
152
|
+
version = "0.1.0"
|
|
153
|
+
|
|
154
|
+
[tool.apdev]
|
|
155
|
+
github_account = "wilfred"
|
|
156
|
+
"""
|
|
157
|
+
),
|
|
158
|
+
encoding="utf-8",
|
|
159
|
+
)
|
|
160
|
+
run = Mock(return_value=subprocess.CompletedProcess(args=[], returncode=0))
|
|
161
|
+
monkeypatch.setattr(cli.subprocess, "run", run)
|
|
162
|
+
|
|
163
|
+
assert cli.main(["release", "--yes"]) == 0
|
|
164
|
+
|
|
165
|
+
args = run.call_args.args[0]
|
|
166
|
+
assert args[2:] == ["--yes", "--account", "wilfred"]
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def test_cli_release_account_flag_beats_config(
|
|
170
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
171
|
+
) -> None:
|
|
172
|
+
"""--account wins over [tool.apdev], and both flags are forwarded."""
|
|
173
|
+
monkeypatch.chdir(tmp_path)
|
|
174
|
+
Path("pyproject.toml").write_text(
|
|
175
|
+
textwrap.dedent(
|
|
176
|
+
"""
|
|
177
|
+
[project]
|
|
178
|
+
name = "demo"
|
|
179
|
+
version = "0.1.0"
|
|
180
|
+
|
|
181
|
+
[tool.apdev]
|
|
182
|
+
github_account = "wilfred"
|
|
183
|
+
pypi_repository = "reachreel"
|
|
184
|
+
"""
|
|
185
|
+
),
|
|
186
|
+
encoding="utf-8",
|
|
187
|
+
)
|
|
188
|
+
run = Mock(return_value=subprocess.CompletedProcess(args=[], returncode=0))
|
|
189
|
+
monkeypatch.setattr(cli.subprocess, "run", run)
|
|
190
|
+
|
|
191
|
+
assert cli.main(["release", "--account", "tercel", "0.2.0"]) == 0
|
|
192
|
+
|
|
193
|
+
args = run.call_args.args[0]
|
|
194
|
+
assert args[2:] == [
|
|
195
|
+
"--repository",
|
|
196
|
+
"reachreel",
|
|
197
|
+
"--account",
|
|
198
|
+
"tercel",
|
|
199
|
+
"0.2.0",
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
|
|
142
203
|
def test_cli_check_chars_clean(tmp_path: Path) -> None:
|
|
143
204
|
"""apdev check-chars returns 0 for clean files."""
|
|
144
205
|
f = tmp_path / "ok.py"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|