Mercurial > hg
view tests/hgweberror.py @ 46326:3e23794b9e1c
run-tests: work around the Windows firewall popup for server processes
Windows doesn't have a `python3` executable, so cc0b332ab9fc attempted to work
around the issue by copying the current python to `python3.exe`. That put it in
`_tmpbindir` because of failures in `test-run-tests.t` when using `_bindir`,
which looked like a process was trying to open it to write out a copy while it
was in use. (Interestingly, I couldn't reproduce this running the test by
itself in a loop for a couple of hours, but it happens constantly when running
all tests.) The problem with using `_tmpbindir` is that it is the randomly
generated path for the test run, and instead of Windows Firewall remembering the
executable signature or image hash when allowing the process to open a server
port, it apparently remembers the image path. That means every run will trigger
a popup to allow it, which is bad for firing off a test run and walking away.
I tried to symlink to the python executable, but that currently requires admin
priviledges[1]. This will prompt the first time if the underlying python binary
has never opened a server port, but appears to avoid it on subsequent runs.
[1] https://bugs.python.org/issue40687
Differential Revision: https://phab.mercurial-scm.org/D9815
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 18 Jan 2021 00:50:01 -0500 |
parents | 2372284d9457 |
children | 6000f5b25c9b |
line wrap: on
line source
# A dummy extension that installs an hgweb command that throws an Exception. from __future__ import absolute_import from mercurial.hgweb import webcommands def raiseerror(web): '''Dummy web command that raises an uncaught Exception.''' # Simulate an error after partial response. if b'partialresponse' in web.req.qsparams: web.res.status = b'200 Script output follows' web.res.headers[b'Content-Type'] = b'text/plain' web.res.setbodywillwrite() list(web.res.sendresponse()) web.res.getbodyfile().write(b'partial content\n') raise AttributeError('I am an uncaught error!') def extsetup(ui): setattr(webcommands, 'raiseerror', raiseerror) webcommands.__all__.append(b'raiseerror')