flyshell 1.3.10__tar.gz → 1.3.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flyshell-1.3.10/src/flyshell.egg-info → flyshell-1.3.12}/PKG-INFO +1 -1
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/constants.py +2 -2
- {flyshell-1.3.10 → flyshell-1.3.12/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell.egg-info/SOURCES.txt +2 -1
- flyshell-1.3.12/tests/test_diskops_lgc.py +84 -0
- flyshell-1.3.10/tests/test_diskops.py → flyshell-1.3.12/tests/test_diskops_old.py +1 -56
- {flyshell-1.3.10 → flyshell-1.3.12}/LICENSE +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/MANIFEST.in +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/README.md +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/diskops.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/posix/cat.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/posix/dir.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/posix/touch.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/shared/dir_types.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/shared/dir_types.h +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/shared/native_errors.h +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/win32/cat.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/win32/dir.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/c_src/diskops/win32/touch.c +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/pyproject.toml +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/setup.cfg +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/setup.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/accounts/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/accounts/auth.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/bin/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/builtin/diskops.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/builtin/pkg.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/core/console.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/core/data.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/core/directory.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/main.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/native/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/native/diskops_bridge.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/native/diskops_handler.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/native/legacy/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/native/legacy/diskops.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/startup/__init__.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/startup/deps.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/startup/env.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell/startup/loader.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_auth.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_data.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_deps.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_directory.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_env.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_fs.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_loader.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_pkg.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_security.py +0 -0
- {flyshell-1.3.10 → flyshell-1.3.12}/tests/test_utils.py +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# tests/test_diskops_lgc.py
|
|
2
|
+
|
|
3
|
+
from flyshell.native import diskops_bridge as bridge
|
|
4
|
+
from flyshell.native import diskops_handler as handler
|
|
5
|
+
from flyshell.native.legacy import diskops as legacy
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture(autouse=True)
|
|
11
|
+
def force_legacy_backend(monkeypatch):
|
|
12
|
+
monkeypatch.setattr(bridge, "has_native_support", lambda: False)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_legacy_touch_creates_file_and_updates_timestamp(tmp_path):
|
|
16
|
+
cmd = handler.Touch()
|
|
17
|
+
target = tmp_path / "test.txt"
|
|
18
|
+
code, msg = cmd.execute([str(target)])
|
|
19
|
+
assert code == 0
|
|
20
|
+
assert "touched successfully" in msg
|
|
21
|
+
assert target.exists()
|
|
22
|
+
code, msg = cmd.execute([str(target)])
|
|
23
|
+
assert code == 0
|
|
24
|
+
assert "touched successfully" in msg
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_legacy_touch_missing_parent_directory(tmp_path):
|
|
28
|
+
cmd = handler.Touch()
|
|
29
|
+
target = tmp_path / "nonexistent_dir" / "test.txt"
|
|
30
|
+
code, msg = cmd.execute([str(target)])
|
|
31
|
+
assert code == 1
|
|
32
|
+
assert "File or path not found" in msg
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_legacy_touch_directory_error(tmp_path):
|
|
36
|
+
code, _ = legacy.lgc_touch(tmp_path)
|
|
37
|
+
assert code == -3 # ERR_IS_DIR
|
|
38
|
+
cmd = handler.Touch()
|
|
39
|
+
exit_code, msg = cmd.execute([str(tmp_path)])
|
|
40
|
+
assert exit_code == 1
|
|
41
|
+
assert "Target is a directory, not a file" in msg
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_legacy_cat_reads_content_with_limit_and_numbers(tmp_path):
|
|
45
|
+
file_path = tmp_path / "sample.txt"
|
|
46
|
+
file_path.write_text("line 1\nline 2\nline 3\nline 4\n", encoding="utf-8")
|
|
47
|
+
cmd = handler.Cat()
|
|
48
|
+
code, msg = cmd.execute([str(file_path)])
|
|
49
|
+
assert code == 0
|
|
50
|
+
assert "line 1" in msg and "line 4" in msg
|
|
51
|
+
code, msg = cmd.execute(["-n", "-l", "2", str(file_path)])
|
|
52
|
+
assert code == 0
|
|
53
|
+
assert "1 | line 1" in msg
|
|
54
|
+
assert "2 | line 2" in msg
|
|
55
|
+
assert "line 3" not in msg
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_legacy_cat_nonexistent_and_empty_file(tmp_path):
|
|
59
|
+
cmd = handler.Cat()
|
|
60
|
+
code, msg = cmd.execute([str(tmp_path / "missing.txt")])
|
|
61
|
+
assert code == 1
|
|
62
|
+
assert "File or path not found" in msg
|
|
63
|
+
empty_file = tmp_path / "empty.txt"
|
|
64
|
+
empty_file.write_text("", encoding="utf-8")
|
|
65
|
+
code, msg = cmd.execute([str(empty_file)])
|
|
66
|
+
assert code == 1
|
|
67
|
+
assert "Target file is empty" in msg
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_legacy_dir_lists_files_and_handles_errors(tmp_path):
|
|
71
|
+
(tmp_path / "alpha_dir").mkdir()
|
|
72
|
+
(tmp_path / "beta.txt").write_text("content", encoding="utf-8")
|
|
73
|
+
cmd = handler.Dir()
|
|
74
|
+
code, msg = cmd.execute([str(tmp_path)])
|
|
75
|
+
assert code == 0
|
|
76
|
+
assert "[DIR] alpha_dir/" in msg
|
|
77
|
+
assert "[FILE] beta.txt" in msg
|
|
78
|
+
assert "Total items in directory: 2" in msg
|
|
79
|
+
code, msg = cmd.execute([str(tmp_path / "missing_dir")])
|
|
80
|
+
assert code == 1
|
|
81
|
+
assert "File or path not found" in msg
|
|
82
|
+
code, msg = cmd.execute([str(tmp_path / "beta.txt")])
|
|
83
|
+
assert code == 1
|
|
84
|
+
assert "Target is not a directory" in msg
|
|
@@ -1,57 +1,6 @@
|
|
|
1
|
-
# tests/
|
|
1
|
+
# tests/test_diskops_old.py
|
|
2
2
|
|
|
3
3
|
from flyshell.builtin import diskops
|
|
4
|
-
import flyshell
|
|
5
|
-
|
|
6
|
-
import pytest
|
|
7
|
-
|
|
8
|
-
pytestmark = pytest.mark.skip(reason="Refactoring diskops to modular native C backend")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_touch_creates_file_and_updates_timestamp(tmp_path):
|
|
12
|
-
cmd = diskops.Touch()
|
|
13
|
-
target = tmp_path / "test.txt"
|
|
14
|
-
code, msg = cmd.execute([str(target)])
|
|
15
|
-
assert code == 0
|
|
16
|
-
assert "Created file" in msg
|
|
17
|
-
assert target.exists()
|
|
18
|
-
code, msg = cmd.execute([str(target)])
|
|
19
|
-
assert code == 0
|
|
20
|
-
assert "Updated timestamp" in msg
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def test_touch_missing_parent_directory(tmp_path):
|
|
24
|
-
cmd = diskops.Touch()
|
|
25
|
-
target = tmp_path / "nonexistent_dir" / "test.txt"
|
|
26
|
-
code, msg = cmd.execute([str(target)])
|
|
27
|
-
assert code == 1
|
|
28
|
-
assert "Parent directory does not exist" in msg
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_cat_reads_content_with_limit_and_numbers(tmp_path):
|
|
32
|
-
file_path = tmp_path / "sample.txt"
|
|
33
|
-
file_path.write_text("line 1\nline 2\nline 3\nline 4\n")
|
|
34
|
-
cmd = diskops.Cat()
|
|
35
|
-
code, msg = cmd.execute([str(file_path)])
|
|
36
|
-
assert code == 0
|
|
37
|
-
assert "line 1" in msg and "line 4" in msg
|
|
38
|
-
code, msg = cmd.execute(["-n", "-l", "2", str(file_path)])
|
|
39
|
-
assert code == 0
|
|
40
|
-
assert "1 | line 1" in msg
|
|
41
|
-
assert "2 | line 2" in msg
|
|
42
|
-
assert "line 3" not in msg
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def test_cat_nonexistent_and_empty_file(tmp_path):
|
|
46
|
-
cmd = diskops.Cat()
|
|
47
|
-
code, msg = cmd.execute([str(tmp_path / "missing.txt")])
|
|
48
|
-
assert code == 1
|
|
49
|
-
assert "not found" in msg
|
|
50
|
-
empty_file = tmp_path / "empty.txt"
|
|
51
|
-
empty_file.write_text("")
|
|
52
|
-
code, msg = cmd.execute([str(empty_file)])
|
|
53
|
-
assert code == 1
|
|
54
|
-
assert "is empty" in msg
|
|
55
4
|
|
|
56
5
|
|
|
57
6
|
def test_mkdir_standard_and_parents(tmp_path):
|
|
@@ -124,7 +73,3 @@ def test_rmdir_empty_and_non_empty(tmp_path):
|
|
|
124
73
|
code, msg = cmd.execute(["-f", str(target_dir)])
|
|
125
74
|
assert code == 0
|
|
126
75
|
assert not target_dir.exists()
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def test_native_disk_c_ext():
|
|
130
|
-
assert flyshell.check_native() is True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|