Skip to content

Commit 0d292ec

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-29
2 parents e7358a9 + 44dae03 commit 0d292ec

File tree

5 files changed

+57
-6
lines changed

5 files changed

+57
-6
lines changed

ci/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ jobs:
292292
displayName: 'Download PuTTY binaries'
293293
294294
- powershell: |
295+
# We don't want the Store MSIX on python.org, so just delete it
296+
# It's already been archived in the earlier publish step, and is bundled
297+
# into the .msixupload file.
298+
del "$(UPLOAD_DIR)\*-store.msix" -ErrorAction SilentlyContinue
295299
python ci\upload.py
296300
displayName: 'Publish packages'
297301
env:

ci/upload.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,6 @@ def purge(url):
199199
upload_ssh(f, p)
200200
print("Purge", u)
201201
purge(u)
202+
203+
# Purge the upload directory so that the FTP browser is up to date
204+
purge(UPLOAD_URL)

src/manage/commands.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,12 +874,18 @@ def execute(self):
874874
class HelpWithErrorCommand(HelpCommand):
875875
CMD = "__help_with_error"
876876

877+
def __init__(self, args, root=None):
878+
# Essentially disable argument processing for this command
879+
super().__init__(args[:1], root)
880+
self.args = args[1:]
881+
877882
def execute(self):
878-
LOGGER.print(f"!R!Unknown command: {EXE_NAME} {' '.join(self.args)}!W!")
883+
args = [EXE_NAME, *self.args]
884+
LOGGER.print(f"!R!Unknown command: {' '.join(args)}!W!")
879885
LOGGER.print(COPYRIGHT)
880886
self.show_welcome(copyright=False)
881887
LOGGER.print(BaseCommand.usage_text())
882-
LOGGER.print(f"The command !R!{EXE_NAME} {' '.join(self.args)}!W! was not recognized.")
888+
LOGGER.print(f"The command !R!{' '.join(args)}!W! was not recognized.")
883889

884890

885891
class DefaultConfig(BaseCommand):

tests/conftest.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,31 @@
2525
LOGGER.level = DEBUG
2626

2727
class LogCaptureHandler(list):
28+
def skip_until(self, pattern, args=()):
29+
return ('until', pattern, args)
30+
2831
def __call__(self, *cmp):
29-
for x, y in zip(self, cmp):
30-
assert re.match(y[0], x[0])
31-
assert x[1] == y[1]
32-
assert len(self) == len(cmp)
32+
it1 = iter(self)
33+
for y in cmp:
34+
if not isinstance(y, tuple):
35+
op, pat, args = None, y, []
36+
elif len(y) == 3:
37+
op, pat, args = y
38+
elif len(y) == 2:
39+
op = None
40+
pat, args = y
41+
42+
while True:
43+
try:
44+
x = next(it1)
45+
except StopIteration:
46+
pytest.fail(f"Not enough elements were logged looking for {pat}")
47+
if op == 'until' and not re.match(pat, x[0]):
48+
continue
49+
assert re.match(pat, x[0])
50+
assert tuple(x[1]) == tuple(args)
51+
break
52+
3353

3454
@pytest.fixture
3555
def assert_log():

tests/test_commands.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
import secrets
3+
from manage import commands
4+
5+
6+
def test_help_with_error_command(assert_log, monkeypatch):
7+
expect = secrets.token_hex(16)
8+
cmd = commands.HelpWithErrorCommand(
9+
[commands.HelpWithErrorCommand.CMD, expect, "-v", "-q"],
10+
None
11+
)
12+
monkeypatch.setattr(commands, "WELCOME", "")
13+
cmd.execute()
14+
assert_log(
15+
assert_log.skip_until(rf".*Unknown command: pymanager-pytest {expect} -v -q.*"),
16+
r"Python installation manager \d+\.\d+.*",
17+
assert_log.skip_until(rf"The command .*?pymanager-pytest {expect} -v -q.*"),
18+
)

0 commit comments

Comments
 (0)