Skip to content

Commit 2d8c3be

Browse files
committed
Remove test that is no longer relevant
1 parent a341d17 commit 2d8c3be

File tree

2 files changed

+5
-46
lines changed

2 files changed

+5
-46
lines changed

jupyter_server_fileid/manager.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def _create(self, path: str) -> str:
317317

318318
if existing_id:
319319
return existing_id
320-
320+
321321
id = self._uuid()
322322
self.con.execute("INSERT INTO Files (id, path) VALUES (?, ?)", (id, path))
323323
return id
@@ -612,7 +612,6 @@ def _sync_file(self, path, stat_info):
612612
"SELECT id, path, crtime FROM Files WHERE ino = ?", (stat_info.ino,)
613613
).fetchone()
614614

615-
616615
# if ino is not in database, return None
617616
if src is None:
618617
return None
@@ -673,17 +672,17 @@ def _create(self, path, stat_info):
673672
dangerous and may throw a runtime error if the file is not guaranteed to
674673
have a unique `ino`.
675674
"""
676-
# If the path exists
675+
# If the path exists
677676
existing_id, ino = None, None
678677
row = self.con.execute("SELECT id, ino FROM Files WHERE path = ?", (path,)).fetchone()
679-
if row:
678+
if row:
680679
existing_id, ino = row
681680

682681
# If the file ID already exists and the current file matches our records
683-
# return the file ID instead of creating a new one.
682+
# return the file ID instead of creating a new one.
684683
if existing_id and stat_info.ino == ino:
685684
return existing_id
686-
685+
687686
id = self._uuid()
688687
self.con.execute(
689688
"INSERT INTO Files (id, path, ino, crtime, mtime, is_dir) VALUES (?, ?, ?, ?, ?, ?)",

tests/test_manager.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ntpath
22
import os
33
import posixpath
4-
import sqlite3
54
import sys
65
from unittest.mock import patch
76

@@ -618,42 +617,3 @@ def test_db_journal_mode(any_fid_manager_class, fid_db_path, jp_root_dir, db_jou
618617
cursor = fid_manager.con.execute("PRAGMA journal_mode")
619618
actual_journal_mode = cursor.fetchone()
620619
assert actual_journal_mode[0].upper() == expected_journal_mode
621-
622-
623-
# This test demonstrates an issue raised in
624-
# https://github.com/jupyter-server/jupyter_server_fileid/pull/76
625-
# which was later fixed in
626-
# https://github.com/jupyter-server/jupyter_server_fileid/pull/77
627-
#
628-
# We use this unit test to catch this edge case and ensure
629-
# its covered going forward.
630-
def test_multiple_fileIdManager_connections_after_exception(fid_db_path):
631-
original_file_path = "/path/to/file"
632-
copy_location = "/path/to/copy"
633-
another_copy_location = "/path/to/other"
634-
635-
# Setup an initial file ID manager connected to a sqlite database.
636-
manager_1 = ArbitraryFileIdManager(db_path=fid_db_path)
637-
638-
# Create an initial ID for this file
639-
manager_1.index(original_file_path)
640-
# Copy the file
641-
manager_1.copy(original_file_path, copy_location)
642-
# Try copying the file again.
643-
excepted = False
644-
try:
645-
manager_1.copy(original_file_path, copy_location)
646-
# We expect this to fail because the file is already in the database.
647-
except sqlite3.IntegrityError:
648-
excepted = True
649-
pass
650-
651-
assert excepted, "Copying to the same location should raise an exception, but it did not here."
652-
653-
# Previously, these actions locked the database for future connections.
654-
# This was fixed in: https://github.com/jupyter-server/jupyter_server_fileid/pull/77
655-
656-
# Try making a second connection that writes to the DB and
657-
# make sure no exceptions were raised.
658-
manager_2 = ArbitraryFileIdManager(db_path=fid_db_path)
659-
manager_2.copy(original_file_path, another_copy_location)

0 commit comments

Comments
 (0)