Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 28, 2025
1 parent 82e049f commit 56b64d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
3 changes: 1 addition & 2 deletions repo2docker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
RBuildPack,
)
from .engine import BuildError, ContainerEngineException, ImageLoadError
from .utils import ByteSpecification, R2dState, chdir, get_platform, get_free_port
from .utils import ByteSpecification, R2dState, chdir, get_free_port, get_platform


class Repo2Docker(Application):
Expand Down Expand Up @@ -744,7 +744,6 @@ def wait_for_container(self, container):
if exit_code:
sys.exit(exit_code)


def find_image(self):
# if this is a dry run it is Ok for dockerd to be unreachable so we
# always return False for dry runs.
Expand Down
4 changes: 2 additions & 2 deletions repo2docker/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import socket
import platform
import re
import socket
import subprocess
import warnings
from contextlib import contextmanager
Expand Down Expand Up @@ -556,4 +556,4 @@ def get_free_port():
s.bind(("", 0))
port = s.getsockname()[1]
s.close()
return port
return port
22 changes: 10 additions & 12 deletions tests/registry/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
from pathlib import Path
import secrets
import subprocess
import time
from pathlib import Path

import pytest
import requests

from repo2docker.__main__ import make_r2d
from repo2docker.utils import get_free_port
import time
import requests
import secrets

HERE = Path(__file__).parent


@pytest.fixture
def registry():
port = get_free_port()
cmd = [
"docker", "run", "-it", "-p", f"{port}:5000", "registry:3.0.0-rc.3"
]
cmd = ["docker", "run", "-it", "-p", f"{port}:5000", "registry:3.0.0-rc.3"]
proc = subprocess.Popen(cmd)
health_url = f'http://localhost:{port}/v2'
health_url = f"http://localhost:{port}/v2"
# Wait for the registry to actually come up
for i in range(10):
try:
Expand All @@ -39,10 +40,7 @@ def registry():

def test_registry(registry):
image_name = f"{registry}/{secrets.token_hex(8)}:latest"
r2d = make_r2d([
"--image", image_name,
"--push", "--no-run", str(HERE)
])
r2d = make_r2d(["--image", image_name, "--push", "--no-run", str(HERE)])

r2d.start()

Expand Down

0 comments on commit 56b64d9

Please sign in to comment.