Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug slow tests on windows with python 3.12 #2628

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 23 additions & 4 deletions scripts/chickn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InternalError(Exception):
"""Raised internally on error."""


async def _exec(cmd) -> Tuple[str, str]:
async def _exec2(cmd) -> Tuple[str, str]:
_LOGGER.debug("Run command: %s", cmd)
proc = await asyncio.create_subprocess_shell(
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
Expand All @@ -42,6 +42,25 @@ async def _exec(cmd) -> Tuple[str, str]:
return stdout, stderr


async def _exec(cmd) -> Tuple[str, str]:
_LOGGER.debug("Run command: %s", cmd)
proc = await asyncio.create_subprocess_shell(
cmd # , stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)

await proc.wait()

stdout = ""
stderr = ""

if proc.returncode != 0:
raise InternalError(
f"Command failed: {cmd}\n[STDOUT]\n{stdout}\n\n[STDERR]\n{stderr}"
)

return stdout, stderr


async def run_step(step, variables) -> None:
"""Run a step with given variables."""
_LOGGER.info("Running step %s", step["name"])
Expand All @@ -67,7 +86,7 @@ async def run_step(step, variables) -> None:
async def run_pip(dependency_files, variables, force_reinstall=False) -> None:
"""Run pip and try to figure out if dependencies needs to be installed."""
# Figure out which packages are installed
stdout, _ = await _exec("pip list --format json")
stdout, _ = await _exec2("pip list --format json")
installed_packages = {
package["name"]: package["version"] for package in json.loads(stdout)
}
Expand Down Expand Up @@ -108,7 +127,7 @@ async def run_pip(dependency_files, variables, force_reinstall=False) -> None:
),
)

await _exec(
await _exec2(
"pip install --upgrade "
+ ("--force-reinstall " if force_reinstall else "")
+ " ".join(
Expand Down Expand Up @@ -140,7 +159,7 @@ async def parse_variable_value(value: Union[str, Sequence[str]]) -> str:

# Execute command and use stdout as value if format is $(command)
if value.startswith("$(") and value.endswith(")"):
return (await _exec(value[2:-1]))[0].rstrip() # Only stdout
return (await _exec2(value[2:-1]))[0].rstrip() # Only stdout

return value

Expand Down
2 changes: 1 addition & 1 deletion tests/protocols/dmap/test_dmap_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def setUpAsync(self):

async def tearDownAsync(self):
await asyncio.gather(*self.atv.close())
super().tearDown()
await super().tearDownAsync()

async def get_application(self, loop=None):
self.fake_atv = FakeAppleTV(self.loop)
Expand Down
Loading