gitex 0.2.17__tar.gz → 0.2.18__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.
- {gitex-0.2.17 → gitex-0.2.18}/PKG-INFO +1 -1
- gitex-0.2.18/gitex/__init__.py +1 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex.egg-info/PKG-INFO +1 -1
- {gitex-0.2.17 → gitex-0.2.18}/tests/test_cli.py +43 -3
- {gitex-0.2.17 → gitex-0.2.18}/tests/test_fences.py +2 -2
- {gitex-0.2.17 → gitex-0.2.18}/tests/test_skip_binaries.py +2 -3
- gitex-0.2.17/gitex/__init__.py +0 -1
- {gitex-0.2.17 → gitex-0.2.18}/README.md +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/dependency_mapper.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/docstring_extractor.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/main.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/models.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/picker/__init__.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/picker/base.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/picker/questionary.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/picker/textuals.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/renderer.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex/utils.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex.egg-info/SOURCES.txt +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex.egg-info/dependency_links.txt +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex.egg-info/entry_points.txt +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex.egg-info/requires.txt +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/gitex.egg-info/top_level.txt +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/pyproject.toml +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/setup.cfg +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/tests/test_render.py +0 -0
- {gitex-0.2.17 → gitex-0.2.18}/tests/test_textual.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.18"
|
|
@@ -2,6 +2,7 @@ import shutil
|
|
|
2
2
|
import tempfile
|
|
3
3
|
import unittest
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from unittest.mock import patch
|
|
5
6
|
|
|
6
7
|
from click.testing import CliRunner
|
|
7
8
|
from git import Repo
|
|
@@ -42,11 +43,15 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
42
43
|
# Should NOT output the file content to stdout
|
|
43
44
|
self.assertNotIn("content inside non-git dir", result.stdout)
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
47
|
+
def test_non_git_repo_force(self, mock_copy):
|
|
46
48
|
"""
|
|
47
49
|
Test that using the --force flag allows gitex to run
|
|
48
50
|
on a non-git directory.
|
|
49
51
|
"""
|
|
52
|
+
# Simulate copy failure so it prints to stdout by default fallback
|
|
53
|
+
mock_copy.return_value = False
|
|
54
|
+
|
|
50
55
|
p = Path(self.test_dir) / "forced_file.txt"
|
|
51
56
|
p.write_text("forced content", encoding="utf-8")
|
|
52
57
|
|
|
@@ -76,10 +81,14 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
76
81
|
self.assertIn("Skipping", result.stderr)
|
|
77
82
|
self.assertNotIn("secret", result.stdout)
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
85
|
+
def test_valid_git_repo(self, mock_copy):
|
|
80
86
|
"""
|
|
81
87
|
Test that gitex runs automatically on a valid git repository.
|
|
82
88
|
"""
|
|
89
|
+
# Simulate copy failure to ensure output falls back to stdout
|
|
90
|
+
mock_copy.return_value = False
|
|
91
|
+
|
|
83
92
|
Repo.init(self.test_dir)
|
|
84
93
|
|
|
85
94
|
p = Path(self.test_dir) / "repo_file.py"
|
|
@@ -89,6 +98,9 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
89
98
|
|
|
90
99
|
self.assertEqual(result.exit_code, 0)
|
|
91
100
|
self.assertNotIn("Skipping", result.stderr)
|
|
101
|
+
|
|
102
|
+
# Verify fallback message
|
|
103
|
+
self.assertIn("Failed to copy", result.stderr)
|
|
92
104
|
|
|
93
105
|
self.assertIn("repo_file.py", result.stdout)
|
|
94
106
|
|
|
@@ -97,6 +109,34 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
97
109
|
self.assertIn("print('hello git')", result.stdout)
|
|
98
110
|
self.assertIn("```", result.stdout)
|
|
99
111
|
|
|
112
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
113
|
+
def test_clipboard_success_silent(self, mock_copy):
|
|
114
|
+
"""Test default behavior: copy succeeds, stdout is silent."""
|
|
115
|
+
mock_copy.return_value = True
|
|
116
|
+
Repo.init(self.test_dir)
|
|
117
|
+
p = Path(self.test_dir) / "file.txt"
|
|
118
|
+
p.write_text("data", encoding="utf-8")
|
|
119
|
+
|
|
120
|
+
result = self.runner.invoke(cli, [self.test_dir])
|
|
121
|
+
|
|
122
|
+
self.assertEqual(result.exit_code, 0)
|
|
123
|
+
self.assertIn("[Copied to clipboard]", result.stderr)
|
|
124
|
+
self.assertEqual("", result.stdout)
|
|
125
|
+
|
|
126
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
127
|
+
def test_clipboard_success_verbose(self, mock_copy):
|
|
128
|
+
"""Test verbose behavior: copy succeeds, stdout prints content."""
|
|
129
|
+
mock_copy.return_value = True
|
|
130
|
+
Repo.init(self.test_dir)
|
|
131
|
+
p = Path(self.test_dir) / "file.txt"
|
|
132
|
+
p.write_text("data", encoding="utf-8")
|
|
133
|
+
|
|
134
|
+
result = self.runner.invoke(cli, [self.test_dir, "-v"])
|
|
135
|
+
|
|
136
|
+
self.assertEqual(result.exit_code, 0)
|
|
137
|
+
self.assertIn("[Copied to clipboard]", result.stderr)
|
|
138
|
+
self.assertIn("data", result.stdout)
|
|
139
|
+
|
|
100
140
|
def test_help_short_flag(self):
|
|
101
141
|
result = self.runner.invoke(cli, ["-h"])
|
|
102
142
|
|
|
@@ -104,4 +144,4 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
104
144
|
self.assertIn("Usage:", result.output)
|
|
105
145
|
|
|
106
146
|
if __name__ == "__main__":
|
|
107
|
-
unittest.main()
|
|
147
|
+
unittest.main()
|
|
@@ -81,7 +81,7 @@ def repo_dir(tmp_path: Path):
|
|
|
81
81
|
def run_gitex(runner: CliRunner, repo_dir: Path):
|
|
82
82
|
return runner.invoke(
|
|
83
83
|
cli,
|
|
84
|
-
[str(repo_dir)],
|
|
84
|
+
[str(repo_dir), "-v"], # Added -v to force output to stdout
|
|
85
85
|
catch_exceptions=False, # IMPORTANT
|
|
86
86
|
)
|
|
87
87
|
|
|
@@ -167,4 +167,4 @@ def test_language_tags_for_known_files(runner, repo_dir):
|
|
|
167
167
|
for fname, lang in expected.items():
|
|
168
168
|
block = extract_block(result.stdout, fname)
|
|
169
169
|
first = block.splitlines()[0]
|
|
170
|
-
assert first.endswith(lang), f"{fname} expected lang '{lang}', got {first!r}"
|
|
170
|
+
assert first.endswith(lang), f"{fname} expected lang '{lang}', got {first!r}"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# tests/test_skip_binaries.py
|
|
2
1
|
import re
|
|
3
2
|
from pathlib import Path
|
|
4
3
|
|
|
@@ -35,7 +34,7 @@ def repo_dir(tmp_path: Path):
|
|
|
35
34
|
def run_gitex(runner: CliRunner, repo_dir: Path):
|
|
36
35
|
return runner.invoke(
|
|
37
36
|
cli,
|
|
38
|
-
[str(repo_dir)],
|
|
37
|
+
[str(repo_dir), "-v"], # Added -v to force output to stdout
|
|
39
38
|
catch_exceptions=False, # IMPORTANT
|
|
40
39
|
)
|
|
41
40
|
|
|
@@ -66,4 +65,4 @@ def test_text_file_is_rendered_normally(runner, repo_dir):
|
|
|
66
65
|
result = run_gitex(runner, repo_dir)
|
|
67
66
|
assert result.exit_code == 0
|
|
68
67
|
assert "# hello.txt\n" in result.stdout
|
|
69
|
-
assert "hello\n" in result.stdout
|
|
68
|
+
assert "hello\n" in result.stdout
|
gitex-0.2.17/gitex/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.17"
|
|
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
|