fix: move pytest.importorskip below pytest import in skip-guarded tests

The original PR placed 'pwd = pytest.importorskip("pwd")' on line 4
but 'import pytest' on line 9 — NameError on module load. Same for
test_file_sync_back.py. Plus, the in-function 'pwd = pytest.importorskip'
calls in test_auto_detected_root_is_rejected confused Python's scope
analysis (later 'import pytest' made pytest local everywhere in the
function) and caused UnboundLocalError. Drop the now-redundant
in-function importorskip calls and rely on the module-level guard.
This commit is contained in:
Teknium 2026-05-09 09:08:17 -07:00
parent 4e8b8573ca
commit b959cfa056
2 changed files with 4 additions and 6 deletions

View file

@ -1,6 +1,5 @@
"""Tests for FileSyncManager.sync_back() — pull remote changes to host."""
fcntl = pytest.importorskip("fcntl")
import io
import logging
import os
@ -12,6 +11,8 @@ from unittest.mock import MagicMock, call, patch
import pytest
fcntl = pytest.importorskip("fcntl")
from tools.environments.file_sync import (
FileSyncManager,
_sha256_file,