Skip to content

Commit e917dfb

Browse files
committed
Reformat with black.
1 parent 2ddfa70 commit e917dfb

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

relink.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
270270
os.rename(link_name, link_name + ".tmp")
271271
logger.info("%sDeleted original file: %s", INDENT, link_name)
272272
except OSError as e:
273-
logger.error("%sError deleting file %s: %s. Skipping relink.", INDENT, link_name, e)
273+
logger.error(
274+
"%sError deleting file %s: %s. Skipping relink.", INDENT, link_name, e
275+
)
274276
return
275277

276278
# Create the symbolic link, handling necessary parent directories
@@ -283,7 +285,10 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
283285
except OSError as e:
284286
os.rename(link_name + ".tmp", link_name)
285287
logger.error(
286-
"%sError creating symlink for %s: %s. Skipping relink.", INDENT, link_name, e
288+
"%sError creating symlink for %s: %s. Skipping relink.",
289+
INDENT,
290+
link_name,
291+
e,
287292
)
288293

289294

tests/relink/test_replace_files_with_symlinks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def fixture_mock_replace_one():
3838
yield mock
3939

4040

41-
def test_basic_file_replacement_given_dir(temp_dirs, current_user, mock_replace_one, caplog):
41+
def test_basic_file_replacement_given_dir(
42+
temp_dirs, current_user, mock_replace_one, caplog
43+
):
4244
"""Test basic functionality: given directory, replace owned file with symlink."""
4345
inputdata_root, target_dir = temp_dirs
4446
username = current_user
@@ -70,7 +72,9 @@ def test_basic_file_replacement_given_dir(temp_dirs, current_user, mock_replace_
7072
assert f"'{source_file}':" in caplog.text
7173

7274

73-
def test_basic_file_replacement_given_file(temp_dirs, current_user, mock_replace_one, caplog):
75+
def test_basic_file_replacement_given_file(
76+
temp_dirs, current_user, mock_replace_one, caplog
77+
):
7478
"""Test basic functionality: given owned file, replace with symlink."""
7579
inputdata_root, target_dir = temp_dirs
7680
username = current_user

tests/rimport/test_check_relink_worked.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# Don't add to sys.modules to avoid conflict with other test files
2323
loader.exec_module(rimport)
2424

25+
2526
def test_ok(tmp_path):
2627
"""Check that it doesn't error if src is a symlink pointing to dst"""
2728
# Set up
@@ -32,6 +33,7 @@ def test_ok(tmp_path):
3233
# Shouldn't error
3334
rimport.check_relink_worked(src, dst)
3435

36+
3537
def test_error_not_symlink(tmp_path):
3638
"""Check that it does error if src isn't a symlink"""
3739
# Set up
@@ -45,6 +47,7 @@ def test_error_not_symlink(tmp_path):
4547
# Verify error message was printed
4648
assert "Error relinking during rimport" in str(exc_info.value)
4749

50+
4851
def test_error_symlink_but_not_to_dst(tmp_path):
4952
"""Check that it does error if src is a symlink but not pointing to dst"""
5053
# Set up
@@ -58,4 +61,4 @@ def test_error_symlink_but_not_to_dst(tmp_path):
5861
rimport.check_relink_worked(src, dst)
5962

6063
# Verify error message was printed
61-
assert "Error relinking during rimport" in str(exc_info.value)
64+
assert "Error relinking during rimport" in str(exc_info.value)

0 commit comments

Comments
 (0)