these 2 derivations will be built: /nix/store/rw7vv0nivqv3v4gsslnabqz4906583ga-python3-3.13.14-env.drv /nix/store/qmhbpv71wrhdqcqy0xk48xd47kjd0ssn-pytest-impure.drv Failed to find a machine for remote build! derivation: kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv required (system, features): (aarch64-linux, [ca-derivations]) 1 available machines: (systems, maxjobs, supportedFeatures, mandatoryFeatures) ([aarch64-darwin, x86_64-darwin], 8, [big-parallel, recursive-nix], []) building '/nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv' pytest-impure> tribuchet: building on eliza pytest-impure> ....FF...........FFFF.F [100%] pytest-impure> =================================== FAILURES =================================== pytest-impure> ___________________ TestFlakeService.test_update_flake_input ___________________ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmpvio4wiy4' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> > result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:191: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> input = None, capture_output = True, timeout = None, check = True pytest-impure> popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpvio4wiy4?shallow=1', 'flake-utils'],) pytest-impure> kwargs = {'cwd': '/build/tmpvio4wiy4', 'stderr': -1, 'stdout': -1, 'text': True} pytest-impure> process = pytest-impure> stdout = '' pytest-impure> stderr = "warning: you don't have Internet access; disabling some network-dependent features\nerror:\n … while updating t...b.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com\n" pytest-impure> retcode = 1 pytest-impure> pytest-impure> def run(*popenargs, pytest-impure> input=None, capture_output=False, timeout=None, check=False, **kwargs): pytest-impure> """Run command with arguments and return a CompletedProcess instance. pytest-impure> pytest-impure> The returned instance will have attributes args, returncode, stdout and pytest-impure> stderr. By default, stdout and stderr are not captured, and those attributes pytest-impure> will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them, pytest-impure> or pass capture_output=True to capture both. pytest-impure> pytest-impure> If check is True and the exit code was non-zero, it raises a pytest-impure> CalledProcessError. The CalledProcessError object will have the return code pytest-impure> in the returncode attribute, and output & stderr attributes if those streams pytest-impure> were captured. pytest-impure> pytest-impure> If timeout (seconds) is given and the process takes too long, pytest-impure> a TimeoutExpired exception will be raised. pytest-impure> pytest-impure> There is an optional argument "input", allowing you to pytest-impure> pass bytes or a string to the subprocess's stdin. If you use this argument pytest-impure> you may not also use the Popen constructor's "stdin" argument, as pytest-impure> it will be used internally. pytest-impure> pytest-impure> By default, all communication is in bytes, and therefore any "input" should pytest-impure> be bytes, and the stdout and stderr will be bytes. If in text mode, any pytest-impure> "input" should be a string, and stdout and stderr will be strings decoded pytest-impure> according to locale encoding, or by "encoding" if set. Text mode is pytest-impure> triggered by setting any of text, encoding, errors or universal_newlines. pytest-impure> pytest-impure> The other arguments are the same as for the Popen constructor. pytest-impure> """ pytest-impure> if input is not None: pytest-impure> if kwargs.get('stdin') is not None: pytest-impure> raise ValueError('stdin and input arguments may not both be used.') pytest-impure> kwargs['stdin'] = PIPE pytest-impure> pytest-impure> if capture_output: pytest-impure> if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: pytest-impure> raise ValueError('stdout and stderr arguments may not be used ' pytest-impure> 'with capture_output.') pytest-impure> kwargs['stdout'] = PIPE pytest-impure> kwargs['stderr'] = PIPE pytest-impure> pytest-impure> with Popen(*popenargs, **kwargs) as process: pytest-impure> try: pytest-impure> stdout, stderr = process.communicate(input, timeout=timeout) pytest-impure> except TimeoutExpired as exc: pytest-impure> process.kill() pytest-impure> if _mswindows: pytest-impure> # Windows accumulates the output in a single blocking pytest-impure> # read() call run on child threads, with the timeout pytest-impure> # being done in a join() on those threads. communicate() pytest-impure> # _after_ kill() is required to collect that and add it pytest-impure> # to the exception. pytest-impure> exc.stdout, exc.stderr = process.communicate() pytest-impure> else: pytest-impure> # POSIX _communicate already populated the output so pytest-impure> # far into the TimeoutExpired exception. pytest-impure> process.wait() pytest-impure> raise pytest-impure> except: # Including KeyboardInterrupt, communicate handled that. pytest-impure> process.kill() pytest-impure> # We don't call process.wait() as .__exit__ does that for us. pytest-impure> raise pytest-impure> retcode = process.poll() pytest-impure> if check and retcode: pytest-impure> > raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpvio4wiy4?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> /nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py:577: CalledProcessError pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> self = pytest-impure> flake_service = pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_update_flake_input( pytest-impure> self, pytest-impure> flake_service: FlakeService, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test updating a flake input and modifying the lock file.""" pytest-impure> # Create a temporary directory for the test pytest-impure> with tempfile.TemporaryDirectory() as temp_dir: pytest-impure> temp_path = Path(temp_dir) pytest-impure> pytest-impure> # Copy minimal flake to temp directory pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.nix", pytest-impure> temp_path / "flake.nix", pytest-impure> ) pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> temp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> # Initialize git repo in temp directory pytest-impure> subprocess.run(["git", "init"], cwd=temp_path, check=True) pytest-impure> subprocess.run(["git", "add", "."], cwd=temp_path, check=True) pytest-impure> subprocess.run( pytest-impure> ["git", "commit", "-m", "Initial commit"], pytest-impure> cwd=temp_path, pytest-impure> check=True, pytest-impure> env={ pytest-impure> **os.environ, pytest-impure> "GIT_AUTHOR_NAME": "Test User", pytest-impure> "GIT_AUTHOR_EMAIL": "test@example.com", pytest-impure> "GIT_COMMITTER_NAME": "Test User", pytest-impure> "GIT_COMMITTER_EMAIL": "test@example.com", pytest-impure> }, pytest-impure> ) pytest-impure> pytest-impure> # Get the original lock file content pytest-impure> original_lock_content = (temp_path / "flake.lock").read_text() pytest-impure> original_lock = json.loads(original_lock_content) pytest-impure> original_flake_utils_rev = original_lock["nodes"]["flake-utils"]["locked"]["rev"] pytest-impure> pytest-impure> # Update flake-utils input pytest-impure> > flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path)) pytest-impure> pytest-impure> tests/test_flake_service.py:198: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmpvio4wiy4' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> # Check if there was a warning about non-existent input pytest-impure> if result.stderr and "does not match any input" in result.stderr: pytest-impure> logger.warning( pytest-impure> "Failed to update input %s in %s: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> result.stderr.strip(), pytest-impure> ) pytest-impure> pytest-impure> logger.info( pytest-impure> "Successfully updated flake input: %s in %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> ) pytest-impure> except subprocess.CalledProcessError as e: pytest-impure> stderr_output = e.stderr.strip() if e.stderr else "No stderr output" pytest-impure> stdout_output = e.stdout.strip() if e.stdout else "No stdout output" pytest-impure> logger.exception( pytest-impure> "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> e.returncode, pytest-impure> stdout_output, pytest-impure> stderr_output, pytest-impure> ) pytest-impure> msg = ( pytest-impure> f"Failed to update flake input {input_name} in {flake_file}: {e}\n" pytest-impure> f"Stderr: {stderr_output}" pytest-impure> ) pytest-impure> > raise FlakeServiceError(msg) from e pytest-impure> E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpvio4wiy4?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> E Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> E error: pytest-impure> E … while updating the lock file of flake 'git+file:///build/tmpvio4wiy4?ref=refs/heads/master&rev=e17c470d6a4fb23a5e6d58217adf513ae896b987&shallow=1' pytest-impure> E pytest-impure> E … while updating the flake input 'flake-utils' pytest-impure> E pytest-impure> E … while fetching the input 'github:numtide/flake-utils' pytest-impure> E pytest-impure> E error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:235: FlakeServiceError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/tmpvio4wiy4/.git/ pytest-impure> [master (root-commit) e17c470] Initial commit pytest-impure> 2 files changed, 55 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/tmpvio4wiy4?ref=refs/heads/master&rev=e17c470d6a4fb23a5e6d58217adf513ae896b987&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpvio4wiy4?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> _________________ TestFlakeService.test_update_subflake_input __________________ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmp27z2sgia' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> > result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:191: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> input = None, capture_output = True, timeout = None, check = True pytest-impure> popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp27z2sgia?shallow=1', 'flake-utils'],) pytest-impure> kwargs = {'cwd': '/build/tmp27z2sgia', 'stderr': -1, 'stdout': -1, 'text': True} pytest-impure> process = pytest-impure> stdout = '' pytest-impure> stderr = "warning: you don't have Internet access; disabling some network-dependent features\nerror:\n … while updating t...b.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com\n" pytest-impure> retcode = 1 pytest-impure> pytest-impure> def run(*popenargs, pytest-impure> input=None, capture_output=False, timeout=None, check=False, **kwargs): pytest-impure> """Run command with arguments and return a CompletedProcess instance. pytest-impure> pytest-impure> The returned instance will have attributes args, returncode, stdout and pytest-impure> stderr. By default, stdout and stderr are not captured, and those attributes pytest-impure> will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them, pytest-impure> or pass capture_output=True to capture both. pytest-impure> pytest-impure> If check is True and the exit code was non-zero, it raises a pytest-impure> CalledProcessError. The CalledProcessError object will have the return code pytest-impure> in the returncode attribute, and output & stderr attributes if those streams pytest-impure> were captured. pytest-impure> pytest-impure> If timeout (seconds) is given and the process takes too long, pytest-impure> a TimeoutExpired exception will be raised. pytest-impure> pytest-impure> There is an optional argument "input", allowing you to pytest-impure> pass bytes or a string to the subprocess's stdin. If you use this argument pytest-impure> you may not also use the Popen constructor's "stdin" argument, as pytest-impure> it will be used internally. pytest-impure> pytest-impure> By default, all communication is in bytes, and therefore any "input" should pytest-impure> be bytes, and the stdout and stderr will be bytes. If in text mode, any pytest-impure> "input" should be a string, and stdout and stderr will be strings decoded pytest-impure> according to locale encoding, or by "encoding" if set. Text mode is pytest-impure> triggered by setting any of text, encoding, errors or universal_newlines. pytest-impure> pytest-impure> The other arguments are the same as for the Popen constructor. pytest-impure> """ pytest-impure> if input is not None: pytest-impure> if kwargs.get('stdin') is not None: pytest-impure> raise ValueError('stdin and input arguments may not both be used.') pytest-impure> kwargs['stdin'] = PIPE pytest-impure> pytest-impure> if capture_output: pytest-impure> if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: pytest-impure> raise ValueError('stdout and stderr arguments may not be used ' pytest-impure> 'with capture_output.') pytest-impure> kwargs['stdout'] = PIPE pytest-impure> kwargs['stderr'] = PIPE pytest-impure> pytest-impure> with Popen(*popenargs, **kwargs) as process: pytest-impure> try: pytest-impure> stdout, stderr = process.communicate(input, timeout=timeout) pytest-impure> except TimeoutExpired as exc: pytest-impure> process.kill() pytest-impure> if _mswindows: pytest-impure> # Windows accumulates the output in a single blocking pytest-impure> # read() call run on child threads, with the timeout pytest-impure> # being done in a join() on those threads. communicate() pytest-impure> # _after_ kill() is required to collect that and add it pytest-impure> # to the exception. pytest-impure> exc.stdout, exc.stderr = process.communicate() pytest-impure> else: pytest-impure> # POSIX _communicate already populated the output so pytest-impure> # far into the TimeoutExpired exception. pytest-impure> process.wait() pytest-impure> raise pytest-impure> except: # Including KeyboardInterrupt, communicate handled that. pytest-impure> process.kill() pytest-impure> # We don't call process.wait() as .__exit__ does that for us. pytest-impure> raise pytest-impure> retcode = process.poll() pytest-impure> if check and retcode: pytest-impure> > raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp27z2sgia?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> /nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py:577: CalledProcessError pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> self = pytest-impure> flake_service = pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_update_subflake_input( pytest-impure> self, pytest-impure> flake_service: FlakeService, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test updating a flake input in a subdirectory (subflake).""" pytest-impure> with tempfile.TemporaryDirectory() as temp_dir: pytest-impure> temp_path = Path(temp_dir) pytest-impure> pytest-impure> # Copy minimal flake to a subdirectory pytest-impure> sub_dir = temp_path / "sub" pytest-impure> sub_dir.mkdir() pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.nix", pytest-impure> sub_dir / "flake.nix", pytest-impure> ) pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> sub_dir / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> # Copy minimal flake to root pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.nix", pytest-impure> temp_path / "flake.nix", pytest-impure> ) pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> temp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> # Initialize git repo in temp directory pytest-impure> subprocess.run(["git", "init"], cwd=temp_path, check=True) pytest-impure> subprocess.run(["git", "add", "."], cwd=temp_path, check=True) pytest-impure> subprocess.run( pytest-impure> ["git", "commit", "-m", "Initial commit"], pytest-impure> cwd=temp_path, pytest-impure> check=True, pytest-impure> env={ pytest-impure> **os.environ, pytest-impure> "GIT_AUTHOR_NAME": "Test User", pytest-impure> "GIT_AUTHOR_EMAIL": "test@example.com", pytest-impure> "GIT_COMMITTER_NAME": "Test User", pytest-impure> "GIT_COMMITTER_EMAIL": "test@example.com", pytest-impure> }, pytest-impure> ) pytest-impure> pytest-impure> original_root_lock = json.loads((temp_path / "flake.lock").read_text()) pytest-impure> original_root_rev = original_root_lock["nodes"]["flake-utils"]["locked"]["rev"] pytest-impure> pytest-impure> original_sub_lock = json.loads((sub_dir / "flake.lock").read_text()) pytest-impure> original_sub_rev = original_sub_lock["nodes"]["flake-utils"]["locked"]["rev"] pytest-impure> pytest-impure> # Update flake-utils in the root flake pytest-impure> > flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path)) pytest-impure> pytest-impure> tests/test_flake_service.py:272: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmp27z2sgia' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> # Check if there was a warning about non-existent input pytest-impure> if result.stderr and "does not match any input" in result.stderr: pytest-impure> logger.warning( pytest-impure> "Failed to update input %s in %s: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> result.stderr.strip(), pytest-impure> ) pytest-impure> pytest-impure> logger.info( pytest-impure> "Successfully updated flake input: %s in %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> ) pytest-impure> except subprocess.CalledProcessError as e: pytest-impure> stderr_output = e.stderr.strip() if e.stderr else "No stderr output" pytest-impure> stdout_output = e.stdout.strip() if e.stdout else "No stdout output" pytest-impure> logger.exception( pytest-impure> "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> e.returncode, pytest-impure> stdout_output, pytest-impure> stderr_output, pytest-impure> ) pytest-impure> msg = ( pytest-impure> f"Failed to update flake input {input_name} in {flake_file}: {e}\n" pytest-impure> f"Stderr: {stderr_output}" pytest-impure> ) pytest-impure> > raise FlakeServiceError(msg) from e pytest-impure> E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp27z2sgia?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> E Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> E error: pytest-impure> E … while updating the lock file of flake 'git+file:///build/tmp27z2sgia?ref=refs/heads/master&rev=4f2111c3337bdc1981e9f9324a53c44dd570bf62&shallow=1' pytest-impure> E pytest-impure> E … while updating the flake input 'flake-utils' pytest-impure> E pytest-impure> E … while fetching the input 'github:numtide/flake-utils' pytest-impure> E pytest-impure> E error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:235: FlakeServiceError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/tmp27z2sgia/.git/ pytest-impure> [master (root-commit) 4f2111c] Initial commit pytest-impure> 4 files changed, 110 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> create mode 100644 sub/flake.lock pytest-impure> create mode 100644 sub/flake.nix pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/tmp27z2sgia?ref=refs/heads/master&rev=4f2111c3337bdc1981e9f9324a53c44dd570bf62&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp27z2sgia?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ___________ TestProcessFlakeUpdates.test_with_updatable_flake_input ____________ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_with_updatable_flake_inpu0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_with_updatable_flake_input( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test PR creation when flake input has available updates.""" pytest-impure> # Create a flake with flake-utils that can be updated pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> # Copy old lock file from minimal fixture pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Change to test directory pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # Create test services pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> # Process updates pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:222: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_with_updatable_flake_inpu0/.git/ pytest-impure> [main (root-commit) cfa373c] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at cfa373c Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-m8oakrh4/update-flake-utils?ref=refs/heads/update-flake-utils&rev=cfa373ce5cbe40ece6254925d98a19b6a927cc74&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-m8oakrh4/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-m8oakrh4/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-m8oakrh4/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-m8oakrh4/update-flake-utils?ref=refs/heads/update-flake-utils&rev=cfa373ce5cbe40ece6254925d98a19b6a927cc74&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> _____ TestProcessFlakeUpdates.test_worktree_based_on_base_branch_not_head ______ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_worktree_based_on_base_br0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_worktree_based_on_base_branch_not_head( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that update branches are based on base_branch, not current HEAD. pytest-impure> pytest-impure> When the action is triggered from a non-main branch, the worktree pytest-impure> should still be based on origin/ so that commits from pytest-impure> the triggering branch don't leak into the update branch. pytest-impure> """ pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Create a feature branch with an extra commit pytest-impure> git_env = { pytest-impure> **os.environ, pytest-impure> "GIT_AUTHOR_NAME": "Test User", pytest-impure> "GIT_AUTHOR_EMAIL": "test@example.com", pytest-impure> "GIT_COMMITTER_NAME": "Test User", pytest-impure> "GIT_COMMITTER_EMAIL": "test@example.com", pytest-impure> } pytest-impure> subprocess.run( pytest-impure> ["git", "checkout", "-b", "feature-branch"], pytest-impure> cwd=tmp_path, pytest-impure> check=True, pytest-impure> ) pytest-impure> (tmp_path / "extra-file.txt").write_text("feature branch content") pytest-impure> subprocess.run(["git", "add", "."], cwd=tmp_path, check=True) pytest-impure> subprocess.run( pytest-impure> ["git", "commit", "-m", "Feature branch commit"], pytest-impure> cwd=tmp_path, pytest-impure> check=True, pytest-impure> env=git_env, pytest-impure> ) pytest-impure> pytest-impure> # Stay on feature-branch (simulating action triggered from non-main branch) pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:328: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_worktree_based_on_base_br0/.git/ pytest-impure> [main (root-commit) 34f3b5d] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> [feature-branch 577a811] Feature branch commit pytest-impure> 1 file changed, 1 insertion(+) pytest-impure> create mode 100644 extra-file.txt pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at 34f3b5d Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0.git pytest-impure> * [new branch] main -> main pytest-impure> Switched to a new branch 'feature-branch' pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-2u9z4207/update-flake-utils?ref=refs/heads/update-flake-utils&rev=34f3b5d3bed31994daedc4f9d1129a343bf3e5a2&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-2u9z4207/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-2u9z4207/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-2u9z4207/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-2u9z4207/update-flake-utils?ref=refs/heads/update-flake-utils&rev=34f3b5d3bed31994daedc4f9d1129a343bf3e5a2&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> ___________ TestProcessFlakeUpdates.test_custom_git_author_committer ___________ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_custom_git_author_committ0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_custom_git_author_committer( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that custom git author/committer configuration is used.""" pytest-impure> # Create a flake with flake-utils pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> # Copy old lock file from minimal fixture pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Change to test directory pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # Create test services with custom git author/committer pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> test_gitea_service.git_author_name = "Custom Bot" pytest-impure> test_gitea_service.git_author_email = "custom@bot.com" pytest-impure> test_gitea_service.git_committer_name = "Custom Committer" pytest-impure> test_gitea_service.git_committer_email = "committer@bot.com" pytest-impure> pytest-impure> # Process updates pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:398: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...itter_name='Custom Committer', git_committer_email='committer@bot.com', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_custom_git_author_committ0/.git/ pytest-impure> [main (root-commit) e067228] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at e067228 Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-ekap6cey/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e0672286e63f00732ed273b683f675b9c2e72fb5&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-ekap6cey/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-ekap6cey/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-ekap6cey/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-ekap6cey/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e0672286e63f00732ed273b683f675b9c2e72fb5&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> __________________ TestProcessFlakeUpdates.test_branch_suffix __________________ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_branch_suffix0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_branch_suffix( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that branch suffix is properly appended to branch names.""" pytest-impure> # Create a flake with flake-utils pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> # Copy old lock file from minimal fixture pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Change to test directory pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # Create test services pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> # Process updates with branch suffix pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "my-suffix", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:465: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = 'my-suffix' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_branch_suffix0/.git/ pytest-impure> [main (root-commit) d52a311] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-flake-utils-my-suffix' set up to track 'origin/main'. pytest-impure> HEAD is now at d52a311 Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils-my-suffix') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-0nsyfg28/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=d52a311ccbe5385d0b1ef0ae2df6704da9d2aae2&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-0nsyfg28/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-0nsyfg28/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-0nsyfg28/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-0nsyfg28/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=d52a311ccbe5385d0b1ef0ae2df6704da9d2aae2&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> ____ TestProcessFlakeUpdates.test_fails_at_end_when_individual_input_fails _____ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_fails_at_end_when_individual_input_fails( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that the action continues updating other inputs but fails at the end.""" pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # FailingFlakeService injects "bad-input" during discovery and pytest-impure> # raises when asked to update it, simulating a 403 or dead ref pytest-impure> flake_service = FailingFlakeService(fail_inputs=["bad-input"]) pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"): pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:597: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> pytest-impure> During handling of the above exception, another exception occurred: pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_fails_at_end_when_individual_input_fails( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that the action continues updating other inputs but fails at the end.""" pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # FailingFlakeService injects "bad-input" during discovery and pytest-impure> # raises when asked to update it, simulating a 403 or dead ref pytest-impure> flake_service = FailingFlakeService(fail_inputs=["bad-input"]) pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> > with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"): pytest-impure> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pytest-impure> E AssertionError: Regex pattern did not match. pytest-impure> E Expected regex: 'Failed to process 1 input' pytest-impure> E Actual message: 'Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix' pytest-impure> pytest-impure> tests/test_process_flake_updates.py:596: AssertionError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0/.git/ pytest-impure> [main (root-commit) 128d589] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-bad-input' set up to track 'origin/main'. pytest-impure> HEAD is now at 128d589 Initial commit pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at 128d589 Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-bad-input') pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input bad-input in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/tests/test_process_flake_updates.py", line 635, in update_flake_input pytest-impure> raise FlakeServiceError(msg) pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Simulated failure updating bad-input pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?ref=refs/heads/update-flake-utils&rev=128d58975676dc1e10a7712534bbb32d56ff1125&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/tests/test_process_flake_updates.py", line 636, in update_flake_input pytest-impure> super().update_flake_input(input_name, flake_file, work_dir) pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?ref=refs/heads/update-flake-utils&rev=128d58975676dc1e10a7712534bbb32d56ff1125&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> =========================== short test summary info ============================ pytest-impure> FAILED tests/test_flake_service.py::TestFlakeService::test_update_flake_input pytest-impure> FAILED tests/test_flake_service.py::TestFlakeService::test_update_subflake_input pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_with_updatable_flake_input pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_worktree_based_on_base_branch_not_head pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_custom_git_author_committer pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_branch_suffix pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_fails_at_end_when_individual_input_fails pytest-impure> 7 failed, 16 passed in 5.92s error: Cannot build '/nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv'. Reason: builder failed with exit code 1. Last 25 log lines: > ^ > File "/build/src/tests/test_process_flake_updates.py", line 636, in update_flake_input > super().update_flake_input(input_name, flake_file, work_dir) > ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input > raise FlakeServiceError(msg) from e > update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. > Stderr: warning: you don't have Internet access; disabling some network-dependent features > error: > … while updating the lock file of flake 'git+file:///build/flake-update-y6dkv7vc/update-flake-utils?ref=refs/heads/update-flake-utils&rev=128d58975676dc1e10a7712534bbb32d56ff1125&shallow=1' > > … while updating the flake input 'flake-utils' > > … while fetching the input 'github:numtide/flake-utils' > > error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com > =========================== short test summary info ============================ > FAILED tests/test_flake_service.py::TestFlakeService::test_update_flake_input > FAILED tests/test_flake_service.py::TestFlakeService::test_update_subflake_input > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_with_updatable_flake_input > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_worktree_based_on_base_branch_not_head > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_custom_git_author_committer > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_branch_suffix > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_fails_at_end_when_individual_input_fails > 7 failed, 16 passed in 5.92s For full logs, run: nix log /nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv error: build of resolved derivation '/nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv' failed nixbot: transient error detected, retrying once this derivation will be built: /nix/store/qmhbpv71wrhdqcqy0xk48xd47kjd0ssn-pytest-impure.drv Failed to find a machine for remote build! derivation: kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv required (system, features): (aarch64-linux, [ca-derivations]) 1 available machines: (systems, maxjobs, supportedFeatures, mandatoryFeatures) ([aarch64-darwin, x86_64-darwin], 8, [big-parallel, recursive-nix], []) building '/nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv' pytest-impure> tribuchet: building on eliza pytest-impure> ....FF...........FFFF.F [100%] pytest-impure> =================================== FAILURES =================================== pytest-impure> ___________________ TestFlakeService.test_update_flake_input ___________________ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmpul6w7l0r' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> > result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:191: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> input = None, capture_output = True, timeout = None, check = True pytest-impure> popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpul6w7l0r?shallow=1', 'flake-utils'],) pytest-impure> kwargs = {'cwd': '/build/tmpul6w7l0r', 'stderr': -1, 'stdout': -1, 'text': True} pytest-impure> process = pytest-impure> stdout = '' pytest-impure> stderr = "warning: you don't have Internet access; disabling some network-dependent features\nerror:\n … while updating t...b.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com\n" pytest-impure> retcode = 1 pytest-impure> pytest-impure> def run(*popenargs, pytest-impure> input=None, capture_output=False, timeout=None, check=False, **kwargs): pytest-impure> """Run command with arguments and return a CompletedProcess instance. pytest-impure> pytest-impure> The returned instance will have attributes args, returncode, stdout and pytest-impure> stderr. By default, stdout and stderr are not captured, and those attributes pytest-impure> will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them, pytest-impure> or pass capture_output=True to capture both. pytest-impure> pytest-impure> If check is True and the exit code was non-zero, it raises a pytest-impure> CalledProcessError. The CalledProcessError object will have the return code pytest-impure> in the returncode attribute, and output & stderr attributes if those streams pytest-impure> were captured. pytest-impure> pytest-impure> If timeout (seconds) is given and the process takes too long, pytest-impure> a TimeoutExpired exception will be raised. pytest-impure> pytest-impure> There is an optional argument "input", allowing you to pytest-impure> pass bytes or a string to the subprocess's stdin. If you use this argument pytest-impure> you may not also use the Popen constructor's "stdin" argument, as pytest-impure> it will be used internally. pytest-impure> pytest-impure> By default, all communication is in bytes, and therefore any "input" should pytest-impure> be bytes, and the stdout and stderr will be bytes. If in text mode, any pytest-impure> "input" should be a string, and stdout and stderr will be strings decoded pytest-impure> according to locale encoding, or by "encoding" if set. Text mode is pytest-impure> triggered by setting any of text, encoding, errors or universal_newlines. pytest-impure> pytest-impure> The other arguments are the same as for the Popen constructor. pytest-impure> """ pytest-impure> if input is not None: pytest-impure> if kwargs.get('stdin') is not None: pytest-impure> raise ValueError('stdin and input arguments may not both be used.') pytest-impure> kwargs['stdin'] = PIPE pytest-impure> pytest-impure> if capture_output: pytest-impure> if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: pytest-impure> raise ValueError('stdout and stderr arguments may not be used ' pytest-impure> 'with capture_output.') pytest-impure> kwargs['stdout'] = PIPE pytest-impure> kwargs['stderr'] = PIPE pytest-impure> pytest-impure> with Popen(*popenargs, **kwargs) as process: pytest-impure> try: pytest-impure> stdout, stderr = process.communicate(input, timeout=timeout) pytest-impure> except TimeoutExpired as exc: pytest-impure> process.kill() pytest-impure> if _mswindows: pytest-impure> # Windows accumulates the output in a single blocking pytest-impure> # read() call run on child threads, with the timeout pytest-impure> # being done in a join() on those threads. communicate() pytest-impure> # _after_ kill() is required to collect that and add it pytest-impure> # to the exception. pytest-impure> exc.stdout, exc.stderr = process.communicate() pytest-impure> else: pytest-impure> # POSIX _communicate already populated the output so pytest-impure> # far into the TimeoutExpired exception. pytest-impure> process.wait() pytest-impure> raise pytest-impure> except: # Including KeyboardInterrupt, communicate handled that. pytest-impure> process.kill() pytest-impure> # We don't call process.wait() as .__exit__ does that for us. pytest-impure> raise pytest-impure> retcode = process.poll() pytest-impure> if check and retcode: pytest-impure> > raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpul6w7l0r?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> /nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py:577: CalledProcessError pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> self = pytest-impure> flake_service = pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_update_flake_input( pytest-impure> self, pytest-impure> flake_service: FlakeService, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test updating a flake input and modifying the lock file.""" pytest-impure> # Create a temporary directory for the test pytest-impure> with tempfile.TemporaryDirectory() as temp_dir: pytest-impure> temp_path = Path(temp_dir) pytest-impure> pytest-impure> # Copy minimal flake to temp directory pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.nix", pytest-impure> temp_path / "flake.nix", pytest-impure> ) pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> temp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> # Initialize git repo in temp directory pytest-impure> subprocess.run(["git", "init"], cwd=temp_path, check=True) pytest-impure> subprocess.run(["git", "add", "."], cwd=temp_path, check=True) pytest-impure> subprocess.run( pytest-impure> ["git", "commit", "-m", "Initial commit"], pytest-impure> cwd=temp_path, pytest-impure> check=True, pytest-impure> env={ pytest-impure> **os.environ, pytest-impure> "GIT_AUTHOR_NAME": "Test User", pytest-impure> "GIT_AUTHOR_EMAIL": "test@example.com", pytest-impure> "GIT_COMMITTER_NAME": "Test User", pytest-impure> "GIT_COMMITTER_EMAIL": "test@example.com", pytest-impure> }, pytest-impure> ) pytest-impure> pytest-impure> # Get the original lock file content pytest-impure> original_lock_content = (temp_path / "flake.lock").read_text() pytest-impure> original_lock = json.loads(original_lock_content) pytest-impure> original_flake_utils_rev = original_lock["nodes"]["flake-utils"]["locked"]["rev"] pytest-impure> pytest-impure> # Update flake-utils input pytest-impure> > flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path)) pytest-impure> pytest-impure> tests/test_flake_service.py:198: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmpul6w7l0r' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> # Check if there was a warning about non-existent input pytest-impure> if result.stderr and "does not match any input" in result.stderr: pytest-impure> logger.warning( pytest-impure> "Failed to update input %s in %s: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> result.stderr.strip(), pytest-impure> ) pytest-impure> pytest-impure> logger.info( pytest-impure> "Successfully updated flake input: %s in %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> ) pytest-impure> except subprocess.CalledProcessError as e: pytest-impure> stderr_output = e.stderr.strip() if e.stderr else "No stderr output" pytest-impure> stdout_output = e.stdout.strip() if e.stdout else "No stdout output" pytest-impure> logger.exception( pytest-impure> "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> e.returncode, pytest-impure> stdout_output, pytest-impure> stderr_output, pytest-impure> ) pytest-impure> msg = ( pytest-impure> f"Failed to update flake input {input_name} in {flake_file}: {e}\n" pytest-impure> f"Stderr: {stderr_output}" pytest-impure> ) pytest-impure> > raise FlakeServiceError(msg) from e pytest-impure> E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpul6w7l0r?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> E Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> E error: pytest-impure> E … while updating the lock file of flake 'git+file:///build/tmpul6w7l0r?ref=refs/heads/master&rev=89d55985da0c4867c0316f4f02fbef95df88c162&shallow=1' pytest-impure> E pytest-impure> E … while updating the flake input 'flake-utils' pytest-impure> E pytest-impure> E … while fetching the input 'github:numtide/flake-utils' pytest-impure> E pytest-impure> E error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:235: FlakeServiceError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/tmpul6w7l0r/.git/ pytest-impure> [master (root-commit) 89d5598] Initial commit pytest-impure> 2 files changed, 55 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/tmpul6w7l0r?ref=refs/heads/master&rev=89d55985da0c4867c0316f4f02fbef95df88c162&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpul6w7l0r?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> _________________ TestFlakeService.test_update_subflake_input __________________ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmppy1d7jtr' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> > result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:191: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> input = None, capture_output = True, timeout = None, check = True pytest-impure> popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///build/tmppy1d7jtr?shallow=1', 'flake-utils'],) pytest-impure> kwargs = {'cwd': '/build/tmppy1d7jtr', 'stderr': -1, 'stdout': -1, 'text': True} pytest-impure> process = pytest-impure> stdout = '' pytest-impure> stderr = "warning: you don't have Internet access; disabling some network-dependent features\nerror:\n … while updating t...b.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com\n" pytest-impure> retcode = 1 pytest-impure> pytest-impure> def run(*popenargs, pytest-impure> input=None, capture_output=False, timeout=None, check=False, **kwargs): pytest-impure> """Run command with arguments and return a CompletedProcess instance. pytest-impure> pytest-impure> The returned instance will have attributes args, returncode, stdout and pytest-impure> stderr. By default, stdout and stderr are not captured, and those attributes pytest-impure> will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them, pytest-impure> or pass capture_output=True to capture both. pytest-impure> pytest-impure> If check is True and the exit code was non-zero, it raises a pytest-impure> CalledProcessError. The CalledProcessError object will have the return code pytest-impure> in the returncode attribute, and output & stderr attributes if those streams pytest-impure> were captured. pytest-impure> pytest-impure> If timeout (seconds) is given and the process takes too long, pytest-impure> a TimeoutExpired exception will be raised. pytest-impure> pytest-impure> There is an optional argument "input", allowing you to pytest-impure> pass bytes or a string to the subprocess's stdin. If you use this argument pytest-impure> you may not also use the Popen constructor's "stdin" argument, as pytest-impure> it will be used internally. pytest-impure> pytest-impure> By default, all communication is in bytes, and therefore any "input" should pytest-impure> be bytes, and the stdout and stderr will be bytes. If in text mode, any pytest-impure> "input" should be a string, and stdout and stderr will be strings decoded pytest-impure> according to locale encoding, or by "encoding" if set. Text mode is pytest-impure> triggered by setting any of text, encoding, errors or universal_newlines. pytest-impure> pytest-impure> The other arguments are the same as for the Popen constructor. pytest-impure> """ pytest-impure> if input is not None: pytest-impure> if kwargs.get('stdin') is not None: pytest-impure> raise ValueError('stdin and input arguments may not both be used.') pytest-impure> kwargs['stdin'] = PIPE pytest-impure> pytest-impure> if capture_output: pytest-impure> if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: pytest-impure> raise ValueError('stdout and stderr arguments may not be used ' pytest-impure> 'with capture_output.') pytest-impure> kwargs['stdout'] = PIPE pytest-impure> kwargs['stderr'] = PIPE pytest-impure> pytest-impure> with Popen(*popenargs, **kwargs) as process: pytest-impure> try: pytest-impure> stdout, stderr = process.communicate(input, timeout=timeout) pytest-impure> except TimeoutExpired as exc: pytest-impure> process.kill() pytest-impure> if _mswindows: pytest-impure> # Windows accumulates the output in a single blocking pytest-impure> # read() call run on child threads, with the timeout pytest-impure> # being done in a join() on those threads. communicate() pytest-impure> # _after_ kill() is required to collect that and add it pytest-impure> # to the exception. pytest-impure> exc.stdout, exc.stderr = process.communicate() pytest-impure> else: pytest-impure> # POSIX _communicate already populated the output so pytest-impure> # far into the TimeoutExpired exception. pytest-impure> process.wait() pytest-impure> raise pytest-impure> except: # Including KeyboardInterrupt, communicate handled that. pytest-impure> process.kill() pytest-impure> # We don't call process.wait() as .__exit__ does that for us. pytest-impure> raise pytest-impure> retcode = process.poll() pytest-impure> if check and retcode: pytest-impure> > raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmppy1d7jtr?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> /nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py:577: CalledProcessError pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> self = pytest-impure> flake_service = pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_update_subflake_input( pytest-impure> self, pytest-impure> flake_service: FlakeService, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test updating a flake input in a subdirectory (subflake).""" pytest-impure> with tempfile.TemporaryDirectory() as temp_dir: pytest-impure> temp_path = Path(temp_dir) pytest-impure> pytest-impure> # Copy minimal flake to a subdirectory pytest-impure> sub_dir = temp_path / "sub" pytest-impure> sub_dir.mkdir() pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.nix", pytest-impure> sub_dir / "flake.nix", pytest-impure> ) pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> sub_dir / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> # Copy minimal flake to root pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.nix", pytest-impure> temp_path / "flake.nix", pytest-impure> ) pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> temp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> # Initialize git repo in temp directory pytest-impure> subprocess.run(["git", "init"], cwd=temp_path, check=True) pytest-impure> subprocess.run(["git", "add", "."], cwd=temp_path, check=True) pytest-impure> subprocess.run( pytest-impure> ["git", "commit", "-m", "Initial commit"], pytest-impure> cwd=temp_path, pytest-impure> check=True, pytest-impure> env={ pytest-impure> **os.environ, pytest-impure> "GIT_AUTHOR_NAME": "Test User", pytest-impure> "GIT_AUTHOR_EMAIL": "test@example.com", pytest-impure> "GIT_COMMITTER_NAME": "Test User", pytest-impure> "GIT_COMMITTER_EMAIL": "test@example.com", pytest-impure> }, pytest-impure> ) pytest-impure> pytest-impure> original_root_lock = json.loads((temp_path / "flake.lock").read_text()) pytest-impure> original_root_rev = original_root_lock["nodes"]["flake-utils"]["locked"]["rev"] pytest-impure> pytest-impure> original_sub_lock = json.loads((sub_dir / "flake.lock").read_text()) pytest-impure> original_sub_rev = original_sub_lock["nodes"]["flake-utils"]["locked"]["rev"] pytest-impure> pytest-impure> # Update flake-utils in the root flake pytest-impure> > flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path)) pytest-impure> pytest-impure> tests/test_flake_service.py:272: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> self = pytest-impure> input_name = 'flake-utils', flake_file = 'flake.nix' pytest-impure> work_dir = '/build/tmppy1d7jtr' pytest-impure> pytest-impure> def update_flake_input( pytest-impure> self, pytest-impure> input_name: str, pytest-impure> flake_file: str, pytest-impure> work_dir: str | None = None, pytest-impure> ) -> None: pytest-impure> """Update a specific flake input. pytest-impure> pytest-impure> Args: pytest-impure> input_name: Name of the input to update pytest-impure> flake_file: Path to the flake file pytest-impure> work_dir: Optional working directory to resolve flake file path from pytest-impure> pytest-impure> """ pytest-impure> try: pytest-impure> logger.info("Updating flake input: %s in %s", input_name, flake_file) pytest-impure> pytest-impure> # If work_dir is provided, resolve the flake file relative to it pytest-impure> absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file) pytest-impure> pytest-impure> flake_dir = absolute_flake_path.parent or Path() pytest-impure> absolute_flake_dir = flake_dir.resolve() pytest-impure> pytest-impure> # Use a shallow URL because worktrees may not have the full history. pytest-impure> # For subflakes, nix needs the URL to point to the git root pytest-impure> # with a dir= parameter rather than the subdirectory directly. pytest-impure> if work_dir: pytest-impure> git_root = Path(work_dir).resolve() pytest-impure> relative_dir = absolute_flake_dir.relative_to(git_root) pytest-impure> flake_url = f"git+file://{git_root}?shallow=1" pytest-impure> if str(relative_dir) != ".": pytest-impure> flake_url += f"&dir={relative_dir}" pytest-impure> else: pytest-impure> flake_url = f"git+file://{absolute_flake_dir}?shallow=1" pytest-impure> pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> "nix", pytest-impure> "flake", pytest-impure> "update", pytest-impure> "--flake", pytest-impure> flake_url, pytest-impure> input_name, pytest-impure> ], pytest-impure> cwd=str(flake_dir), pytest-impure> capture_output=True, pytest-impure> text=True, pytest-impure> check=True, pytest-impure> ) pytest-impure> pytest-impure> # Check if there was a warning about non-existent input pytest-impure> if result.stderr and "does not match any input" in result.stderr: pytest-impure> logger.warning( pytest-impure> "Failed to update input %s in %s: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> result.stderr.strip(), pytest-impure> ) pytest-impure> pytest-impure> logger.info( pytest-impure> "Successfully updated flake input: %s in %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> ) pytest-impure> except subprocess.CalledProcessError as e: pytest-impure> stderr_output = e.stderr.strip() if e.stderr else "No stderr output" pytest-impure> stdout_output = e.stdout.strip() if e.stdout else "No stdout output" pytest-impure> logger.exception( pytest-impure> "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s", pytest-impure> input_name, pytest-impure> flake_file, pytest-impure> e.returncode, pytest-impure> stdout_output, pytest-impure> stderr_output, pytest-impure> ) pytest-impure> msg = ( pytest-impure> f"Failed to update flake input {input_name} in {flake_file}: {e}\n" pytest-impure> f"Stderr: {stderr_output}" pytest-impure> ) pytest-impure> > raise FlakeServiceError(msg) from e pytest-impure> E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmppy1d7jtr?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> E Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> E error: pytest-impure> E … while updating the lock file of flake 'git+file:///build/tmppy1d7jtr?ref=refs/heads/master&rev=e7046e4c0943f40d99cd485c3e7c7a095414e16c&shallow=1' pytest-impure> E pytest-impure> E … while updating the flake input 'flake-utils' pytest-impure> E pytest-impure> E … while fetching the input 'github:numtide/flake-utils' pytest-impure> E pytest-impure> E error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> pytest-impure> src/update_flake_inputs/flake_service.py:235: FlakeServiceError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/tmppy1d7jtr/.git/ pytest-impure> [master (root-commit) e7046e4] Initial commit pytest-impure> 4 files changed, 110 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> create mode 100644 sub/flake.lock pytest-impure> create mode 100644 sub/flake.nix pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/tmppy1d7jtr?ref=refs/heads/master&rev=e7046e4c0943f40d99cd485c3e7c7a095414e16c&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmppy1d7jtr?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ___________ TestProcessFlakeUpdates.test_with_updatable_flake_input ____________ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_with_updatable_flake_inpu0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_with_updatable_flake_input( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test PR creation when flake input has available updates.""" pytest-impure> # Create a flake with flake-utils that can be updated pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> # Copy old lock file from minimal fixture pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Change to test directory pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # Create test services pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> # Process updates pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:222: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_with_updatable_flake_inpu0/.git/ pytest-impure> [main (root-commit) e6e8223] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at e6e8223 Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-k3fbvxf1/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e6e8223434e2e6387a4fa7781577c61710837b19&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-k3fbvxf1/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-k3fbvxf1/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-k3fbvxf1/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-k3fbvxf1/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e6e8223434e2e6387a4fa7781577c61710837b19&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> _____ TestProcessFlakeUpdates.test_worktree_based_on_base_branch_not_head ______ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_worktree_based_on_base_br0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_worktree_based_on_base_branch_not_head( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that update branches are based on base_branch, not current HEAD. pytest-impure> pytest-impure> When the action is triggered from a non-main branch, the worktree pytest-impure> should still be based on origin/ so that commits from pytest-impure> the triggering branch don't leak into the update branch. pytest-impure> """ pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Create a feature branch with an extra commit pytest-impure> git_env = { pytest-impure> **os.environ, pytest-impure> "GIT_AUTHOR_NAME": "Test User", pytest-impure> "GIT_AUTHOR_EMAIL": "test@example.com", pytest-impure> "GIT_COMMITTER_NAME": "Test User", pytest-impure> "GIT_COMMITTER_EMAIL": "test@example.com", pytest-impure> } pytest-impure> subprocess.run( pytest-impure> ["git", "checkout", "-b", "feature-branch"], pytest-impure> cwd=tmp_path, pytest-impure> check=True, pytest-impure> ) pytest-impure> (tmp_path / "extra-file.txt").write_text("feature branch content") pytest-impure> subprocess.run(["git", "add", "."], cwd=tmp_path, check=True) pytest-impure> subprocess.run( pytest-impure> ["git", "commit", "-m", "Feature branch commit"], pytest-impure> cwd=tmp_path, pytest-impure> check=True, pytest-impure> env=git_env, pytest-impure> ) pytest-impure> pytest-impure> # Stay on feature-branch (simulating action triggered from non-main branch) pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:328: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_worktree_based_on_base_br0/.git/ pytest-impure> [main (root-commit) e6e8223] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> [feature-branch 2d2646e] Feature branch commit pytest-impure> 1 file changed, 1 insertion(+) pytest-impure> create mode 100644 extra-file.txt pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at e6e8223 Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0.git pytest-impure> * [new branch] main -> main pytest-impure> Switched to a new branch 'feature-branch' pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-czhzb3uv/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e6e8223434e2e6387a4fa7781577c61710837b19&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-czhzb3uv/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-czhzb3uv/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-czhzb3uv/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-czhzb3uv/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e6e8223434e2e6387a4fa7781577c61710837b19&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> ___________ TestProcessFlakeUpdates.test_custom_git_author_committer ___________ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_custom_git_author_committ0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_custom_git_author_committer( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that custom git author/committer configuration is used.""" pytest-impure> # Create a flake with flake-utils pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> # Copy old lock file from minimal fixture pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Change to test directory pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # Create test services with custom git author/committer pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> test_gitea_service.git_author_name = "Custom Bot" pytest-impure> test_gitea_service.git_author_email = "custom@bot.com" pytest-impure> test_gitea_service.git_committer_name = "Custom Committer" pytest-impure> test_gitea_service.git_committer_email = "committer@bot.com" pytest-impure> pytest-impure> # Process updates pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:398: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...itter_name='Custom Committer', git_committer_email='committer@bot.com', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_custom_git_author_committ0/.git/ pytest-impure> [main (root-commit) db1d398] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at db1d398 Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-xcxj5obi/update-flake-utils?ref=refs/heads/update-flake-utils&rev=db1d3980dbc568f4846e6a3ea792a4affcd45c2d&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-xcxj5obi/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-xcxj5obi/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-xcxj5obi/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-xcxj5obi/update-flake-utils?ref=refs/heads/update-flake-utils&rev=db1d3980dbc568f4846e6a3ea792a4affcd45c2d&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> __________________ TestProcessFlakeUpdates.test_branch_suffix __________________ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_branch_suffix0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_branch_suffix( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that branch suffix is properly appended to branch names.""" pytest-impure> # Create a flake with flake-utils pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> # Copy old lock file from minimal fixture pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> # Change to test directory pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # Create test services pytest-impure> flake_service = FlakeService() pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> # Process updates with branch suffix pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "my-suffix", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:465: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = 'my-suffix' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_branch_suffix0/.git/ pytest-impure> [main (root-commit) 8ddbe3d] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-flake-utils-my-suffix' set up to track 'origin/main'. pytest-impure> HEAD is now at 8ddbe3d Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils-my-suffix') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-5auq95y3/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=8ddbe3d2ece5daed4f26df3c1c2194bb76ab1d75&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-5auq95y3/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-5auq95y3/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-5auq95y3/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-5auq95y3/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=8ddbe3d2ece5daed4f26df3c1c2194bb76ab1d75&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> ____ TestProcessFlakeUpdates.test_fails_at_end_when_individual_input_fails _____ pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_fails_at_end_when_individual_input_fails( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that the action continues updating other inputs but fails at the end.""" pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # FailingFlakeService injects "bad-input" during discovery and pytest-impure> # raises when asked to update it, simulating a 403 or dead ref pytest-impure> flake_service = FailingFlakeService(fail_inputs=["bad-input"]) pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"): pytest-impure> > process_flake_updates( pytest-impure> flake_service, pytest-impure> test_gitea_service, pytest-impure> "", pytest-impure> "main", pytest-impure> "", pytest-impure> auto_merge=False, pytest-impure> ) pytest-impure> pytest-impure> tests/test_process_flake_updates.py:597: pytest-impure> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pytest-impure> pytest-impure> flake_service = pytest-impure> gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[]) pytest-impure> exclude_patterns = '', base_branch = 'main', branch_suffix = '' pytest-impure> pytest-impure> def process_flake_updates( # noqa: PLR0913 pytest-impure> flake_service: FlakeService, pytest-impure> gitea_service: GiteaService, pytest-impure> exclude_patterns: str, pytest-impure> base_branch: str, pytest-impure> branch_suffix: str, pytest-impure> *, pytest-impure> auto_merge: bool, pytest-impure> ) -> None: pytest-impure> """Process all flake updates. pytest-impure> pytest-impure> Args: pytest-impure> flake_service: Flake service instance pytest-impure> gitea_service: Gitea service instance pytest-impure> exclude_patterns: Patterns to exclude pytest-impure> base_branch: Base branch for PRs pytest-impure> branch_suffix: Optional suffix to append to branch names pytest-impure> auto_merge: Whether to automatically merge PRs pytest-impure> pytest-impure> """ pytest-impure> # Discover flake files pytest-impure> flakes = flake_service.discover_flake_files(exclude_patterns) pytest-impure> if not flakes: pytest-impure> logger.info("No flake files found") pytest-impure> return pytest-impure> pytest-impure> logger.info("Found %d flake files to process", len(flakes)) pytest-impure> pytest-impure> failed_inputs: list[str] = [] pytest-impure> pytest-impure> # Process each flake pytest-impure> for flake in flakes: pytest-impure> logger.info("Processing flake: %s", flake.file_path) pytest-impure> logger.info("Inputs to update: %s", ", ".join(flake.inputs)) pytest-impure> pytest-impure> # Don't include '.' for root directory pytest-impure> parent_path = Path(flake.file_path).parent pytest-impure> parent_suffix = "" if parent_path == Path() else f" in {parent_path}" pytest-impure> parent_branch = "" if parent_path == Path() else f"-{parent_path}" pytest-impure> suffix = branch_suffix.strip().replace("/", "-").strip("-") pytest-impure> pytest-impure> # Update each input pytest-impure> for input_name in flake.inputs: pytest-impure> try: pytest-impure> branch_name = f"update{parent_branch}-{input_name}" pytest-impure> branch_name = branch_name.replace("/", "-").strip("-") pytest-impure> if suffix: pytest-impure> branch_name = f"{branch_name}-{suffix}" pytest-impure> pytest-impure> logger.info( pytest-impure> "Updating input %s in %s (branch: %s)", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> branch_name, pytest-impure> ) pytest-impure> pytest-impure> # Create worktree and update input pytest-impure> with gitea_service.worktree(branch_name, base_branch) as worktree_path: pytest-impure> # Update the input pytest-impure> flake_service.update_flake_input( pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> str(worktree_path), pytest-impure> ) pytest-impure> pytest-impure> # Commit changes pytest-impure> commit_message = f"Update {input_name}{parent_suffix}" pytest-impure> if gitea_service.commit_changes( pytest-impure> branch_name, pytest-impure> commit_message, pytest-impure> worktree_path, pytest-impure> ): pytest-impure> # Create pull request pytest-impure> pr_title = commit_message pytest-impure> pr_body = ( pytest-impure> f"This PR updates the `{input_name}` input " pytest-impure> f"in `{flake.file_path}`.\n\n" pytest-impure> "Generated by update-flake-inputs action." pytest-impure> ) pytest-impure> gitea_service.create_pull_request( pytest-impure> branch_name, pytest-impure> base_branch, pytest-impure> pr_title, pytest-impure> pr_body, pytest-impure> auto_merge=auto_merge, pytest-impure> ) pytest-impure> else: pytest-impure> logger.info( pytest-impure> "No changes for input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> gitea_service.delete_branch(branch_name) pytest-impure> pytest-impure> except Exception: pytest-impure> logger.exception( pytest-impure> "Failed to update input %s in %s", pytest-impure> input_name, pytest-impure> flake.file_path, pytest-impure> ) pytest-impure> failed_inputs.append(f"{input_name} in {flake.file_path}") pytest-impure> pytest-impure> if failed_inputs: pytest-impure> msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}" pytest-impure> > raise UpdateFlakeInputsError(msg) pytest-impure> E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix pytest-impure> pytest-impure> src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError pytest-impure> pytest-impure> During handling of the above exception, another exception occurred: pytest-impure> pytest-impure> self = pytest-impure> tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0') pytest-impure> fixtures_path = PosixPath('/build/src/tests/fixtures') pytest-impure> pytest-impure> @pytest.mark.impure pytest-impure> def test_fails_at_end_when_individual_input_fails( pytest-impure> self, pytest-impure> tmp_path: Path, pytest-impure> fixtures_path: Path, pytest-impure> ) -> None: pytest-impure> """Test that the action continues updating other inputs but fails at the end.""" pytest-impure> flake_content = """{ pytest-impure> inputs = { pytest-impure> flake-utils.url = "github:numtide/flake-utils"; pytest-impure> }; pytest-impure> pytest-impure> outputs = { self, flake-utils }: { pytest-impure> # Test flake with updatable input pytest-impure> }; pytest-impure> }""" pytest-impure> pytest-impure> (tmp_path / "flake.nix").write_text(flake_content) pytest-impure> pytest-impure> shutil.copy( pytest-impure> fixtures_path / "minimal" / "flake.lock", pytest-impure> tmp_path / "flake.lock", pytest-impure> ) pytest-impure> pytest-impure> _setup_git_repo(tmp_path) pytest-impure> pytest-impure> original_cwd = Path.cwd() pytest-impure> os.chdir(tmp_path) pytest-impure> pytest-impure> try: pytest-impure> # FailingFlakeService injects "bad-input" during discovery and pytest-impure> # raises when asked to update it, simulating a 403 or dead ref pytest-impure> flake_service = FailingFlakeService(fail_inputs=["bad-input"]) pytest-impure> test_gitea_service = MockGiteaService() pytest-impure> pytest-impure> > with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"): pytest-impure> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pytest-impure> E AssertionError: Regex pattern did not match. pytest-impure> E Expected regex: 'Failed to process 1 input' pytest-impure> E Actual message: 'Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix' pytest-impure> pytest-impure> tests/test_process_flake_updates.py:596: AssertionError pytest-impure> ----------------------------- Captured stdout call ----------------------------- pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0/.git/ pytest-impure> [main (root-commit) de1321d] Initial commit pytest-impure> 2 files changed, 53 insertions(+) pytest-impure> create mode 100644 flake.lock pytest-impure> create mode 100644 flake.nix pytest-impure> Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0.git/ pytest-impure> branch 'main' set up to track 'origin/main'. pytest-impure> branch 'update-bad-input' set up to track 'origin/main'. pytest-impure> HEAD is now at de1321d Initial commit pytest-impure> branch 'update-flake-utils' set up to track 'origin/main'. pytest-impure> HEAD is now at de1321d Initial commit pytest-impure> ----------------------------- Captured stderr call ----------------------------- pytest-impure> hint: Using 'master' as the name for the initial branch. This default branch name pytest-impure> hint: will change to "main" in Git 3.0. To configure the initial branch name pytest-impure> hint: to use in all of your new repositories, which will suppress this warning, pytest-impure> hint: call: pytest-impure> hint: pytest-impure> hint: git config --global init.defaultBranch pytest-impure> hint: pytest-impure> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and pytest-impure> hint: 'development'. The just-created branch can be renamed via this command: pytest-impure> hint: pytest-impure> hint: git branch -m pytest-impure> hint: pytest-impure> hint: Disable this message with "git config set advice.defaultBranchName false" pytest-impure> To /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0.git pytest-impure> * [new branch] main -> main pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-bad-input') pytest-impure> From /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0 pytest-impure> * branch main -> FETCH_HEAD pytest-impure> Preparing worktree (new branch 'update-flake-utils') pytest-impure> ------------------------------ Captured log call ------------------------------- pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input bad-input in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/tests/test_process_flake_updates.py", line 635, in update_flake_input pytest-impure> raise FlakeServiceError(msg) pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Simulated failure updating bad-input pytest-impure> ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1 pytest-impure> Stdout: No stdout output pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-x10plhr7/update-flake-utils?ref=refs/heads/update-flake-utils&rev=de1321d2eb7913fcda733fc2f46bac51c72e0e08&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-x10plhr7/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input pytest-impure> result = subprocess.run( pytest-impure> [ pytest-impure> ...<10 lines>... pytest-impure> check=True, pytest-impure> ) pytest-impure> File "/nix/store/hba6yralbahlkci5yl40izyh49y0d971-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run pytest-impure> raise CalledProcessError(retcode, process.args, pytest-impure> output=stdout, stderr=stderr) pytest-impure> subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-x10plhr7/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> pytest-impure> The above exception was the direct cause of the following exception: pytest-impure> pytest-impure> Traceback (most recent call last): pytest-impure> File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates pytest-impure> flake_service.update_flake_input( pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ pytest-impure> input_name, pytest-impure> ^^^^^^^^^^^ pytest-impure> flake.file_path, pytest-impure> ^^^^^^^^^^^^^^^^ pytest-impure> str(worktree_path), pytest-impure> ^^^^^^^^^^^^^^^^^^^ pytest-impure> ) pytest-impure> ^ pytest-impure> File "/build/src/tests/test_process_flake_updates.py", line 636, in update_flake_input pytest-impure> super().update_flake_input(input_name, flake_file, work_dir) pytest-impure> ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pytest-impure> File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input pytest-impure> raise FlakeServiceError(msg) from e pytest-impure> update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-x10plhr7/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. pytest-impure> Stderr: warning: you don't have Internet access; disabling some network-dependent features pytest-impure> error: pytest-impure> … while updating the lock file of flake 'git+file:///build/flake-update-x10plhr7/update-flake-utils?ref=refs/heads/update-flake-utils&rev=de1321d2eb7913fcda733fc2f46bac51c72e0e08&shallow=1' pytest-impure> pytest-impure> … while updating the flake input 'flake-utils' pytest-impure> pytest-impure> … while fetching the input 'github:numtide/flake-utils' pytest-impure> pytest-impure> error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com pytest-impure> =========================== short test summary info ============================ pytest-impure> FAILED tests/test_flake_service.py::TestFlakeService::test_update_flake_input pytest-impure> FAILED tests/test_flake_service.py::TestFlakeService::test_update_subflake_input pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_with_updatable_flake_input pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_worktree_based_on_base_branch_not_head pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_custom_git_author_committer pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_branch_suffix pytest-impure> FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_fails_at_end_when_individual_input_fails pytest-impure> 7 failed, 16 passed in 5.59s error: Cannot build '/nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv'. Reason: builder failed with exit code 1. Last 25 log lines: > ^ > File "/build/src/tests/test_process_flake_updates.py", line 636, in update_flake_input > super().update_flake_input(input_name, flake_file, work_dir) > ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input > raise FlakeServiceError(msg) from e > update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-x10plhr7/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1. > Stderr: warning: you don't have Internet access; disabling some network-dependent features > error: > … while updating the lock file of flake 'git+file:///build/flake-update-x10plhr7/update-flake-utils?ref=refs/heads/update-flake-utils&rev=de1321d2eb7913fcda733fc2f46bac51c72e0e08&shallow=1' > > … while updating the flake input 'flake-utils' > > … while fetching the input 'github:numtide/flake-utils' > > error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com > =========================== short test summary info ============================ > FAILED tests/test_flake_service.py::TestFlakeService::test_update_flake_input > FAILED tests/test_flake_service.py::TestFlakeService::test_update_subflake_input > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_with_updatable_flake_input > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_worktree_based_on_base_branch_not_head > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_custom_git_author_committer > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_branch_suffix > FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_fails_at_end_when_individual_input_fails > 7 failed, 16 passed in 5.59s For full logs, run: nix log /nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv error: build of resolved derivation '/nix/store/kjs38akp57z1m6b11w0gdk5flpnylkyc-pytest-impure.drv' failed