| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ | |||
| 4 | 4 | /.envrc | |
| 5 | 5 | /.tox/ | |
| 6 | 6 | /build/ | |
| 7 | + /ci/ | ||
| 7 | 8 | /dist/ | |
| 8 | 9 | /docs/_build/ | |
| 9 | 10 | /MANIFEST | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -337,8 +337,6 @@ def new(a: Literal['char **']) -> _Pointer[char_pointer]: ... | |||
| 337 | 337 | @overload | |
| 338 | 338 | def new(a: Literal['char[]', 'char []'], b: bytes | NULL_TYPE) -> ArrayC[char]: ... | |
| 339 | 339 | @overload | |
| 340 | - def new(a: Literal['char ***']) -> Any: ... # For extensions_ptr in GET_EXTENSIONS | ||
| 341 | - @overload | ||
| 342 | 340 | def new(a: Literal['char *[]'], b: int) -> ArrayC[char_pointer]: ... # For ext_array in SET_EXTENSIONS | |
| 343 | 341 | @overload | |
| 344 | 342 | def new(a: Literal['char *[]'], b: list[Any]) -> ArrayC[char_pointer]: ... # For string arrays | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,47 +201,43 @@ def test_extensions() -> None: | |||
| 201 | 201 | # Get initial extensions list | |
| 202 | 202 | original_extensions = option(Option.GET_EXTENSIONS) | |
| 203 | 203 | assert isinstance(original_extensions, list) | |
| 204 | - | ||
| 205 | - # Try to set extensions (this might fail depending on the setup) | ||
| 206 | - try: | ||
| 207 | - test_extensions = ['objectformat', 'worktreeconfig'] | ||
| 208 | - option(Option.SET_EXTENSIONS, test_extensions, len(test_extensions)) | ||
| 209 | - | ||
| 210 | - # Verify they were set | ||
| 211 | - new_extensions = option(Option.GET_EXTENSIONS) | ||
| 212 | - assert isinstance(new_extensions, list) | ||
| 213 | - | ||
| 214 | - # Check that our extensions are present | ||
| 215 | - # Note: libgit2 may add its own built-in extensions and sort them | ||
| 216 | - for ext in test_extensions: | ||
| 217 | - assert ext in new_extensions, f"Extension '{ext}' not found in {new_extensions}" | ||
| 218 | - | ||
| 219 | - # Test with empty list | ||
| 204 | + | ||
| 205 | + # Set extensions | ||
| 206 | + test_extensions = ['objectformat', 'worktreeconfig'] | ||
| 207 | + option(Option.SET_EXTENSIONS, test_extensions, len(test_extensions)) | ||
| 208 | + | ||
| 209 | + # Verify they were set | ||
| 210 | + new_extensions = option(Option.GET_EXTENSIONS) | ||
| 211 | + assert isinstance(new_extensions, list) | ||
| 212 | + | ||
| 213 | + # Check that our extensions are present | ||
| 214 | + # Note: libgit2 may add its own built-in extensions and sort them | ||
| 215 | + for ext in test_extensions: | ||
| 216 | + assert ext in new_extensions, f"Extension '{ext}' not found in {new_extensions}" | ||
| 217 | + | ||
| 218 | + # Test with empty list | ||
| 219 | + option(Option.SET_EXTENSIONS, [], 0) | ||
| 220 | + empty_extensions = option(Option.GET_EXTENSIONS) | ||
| 221 | + assert isinstance(empty_extensions, list) | ||
| 222 | + # Even with empty input, libgit2 may have built-in extensions | ||
| 223 | + | ||
| 224 | + # Test with a custom extension | ||
| 225 | + custom_extensions = ['myextension', 'objectformat'] | ||
| 226 | + option(Option.SET_EXTENSIONS, custom_extensions, len(custom_extensions)) | ||
| 227 | + custom_result = option(Option.GET_EXTENSIONS) | ||
| 228 | + assert 'myextension' in custom_result | ||
| 229 | + assert 'objectformat' in custom_result | ||
| 230 | + | ||
| 231 | + # Restore original extensions | ||
| 232 | + if original_extensions: | ||
| 233 | + option(Option.SET_EXTENSIONS, original_extensions, len(original_extensions)) | ||
| 234 | + else: | ||
| 235 | + # Reset to empty list if there were no extensions | ||
| 220 | 236 | option(Option.SET_EXTENSIONS, [], 0) | |
| 221 | - empty_extensions = option(Option.GET_EXTENSIONS) | ||
| 222 | - assert isinstance(empty_extensions, list) | ||
| 223 | - # Even with empty input, libgit2 may have built-in extensions | ||
| 224 | - | ||
| 225 | - # Test with a custom extension | ||
| 226 | - custom_extensions = ['myextension', 'objectformat'] | ||
| 227 | - option(Option.SET_EXTENSIONS, custom_extensions, len(custom_extensions)) | ||
| 228 | - custom_result = option(Option.GET_EXTENSIONS) | ||
| 229 | - assert 'myextension' in custom_result | ||
| 230 | - assert 'objectformat' in custom_result | ||
| 231 | - | ||
| 232 | - # Restore original extensions | ||
| 233 | - if original_extensions: | ||
| 234 | - option(Option.SET_EXTENSIONS, original_extensions, len(original_extensions)) | ||
| 235 | - else: | ||
| 236 | - # Reset to empty list if there were no extensions | ||
| 237 | - option(Option.SET_EXTENSIONS, [], 0) | ||
| 238 | - | ||
| 239 | - # Verify restoration | ||
| 240 | - final_extensions = option(Option.GET_EXTENSIONS) | ||
| 241 | - assert set(final_extensions) == set(original_extensions) | ||
| 242 | - except Exception: | ||
| 243 | - # May fail if extensions cannot be modified | ||
| 244 | - pass | ||
| 237 | + | ||
| 238 | + # Verify restoration | ||
| 239 | + final_extensions = option(Option.GET_EXTENSIONS) | ||
| 240 | + assert set(final_extensions) == set(original_extensions) | ||
| 245 | 241 | ||
| 246 | 242 | ||
| 247 | 243 | def test_homedir() -> None: | |
@@ -289,13 +285,20 @@ def test_user_agent_product() -> None: | |||
| 289 | 285 | ||
| 290 | 286 | ||
| 291 | 287 | def test_add_ssl_x509_cert() -> None: | |
| 292 | - # Test adding an SSL certificate (basic test, just ensure it doesn't crash) | ||
| 288 | + # Test adding an SSL certificate | ||
| 289 | + # This is a minimal test certificate (not valid, but tests the API) | ||
| 293 | 290 | test_cert = "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----" | |
| 291 | + | ||
| 294 | 292 | try: | |
| 295 | 293 | option(Option.ADD_SSL_X509_CERT, test_cert) | |
| 296 | - except Exception: | ||
| 297 | - # May fail depending on SSL backend | ||
| 298 | - pass | ||
| 294 | + except pygit2.GitError as e: | ||
| 295 | + # May fail if TLS backend doesn't support adding raw certs | ||
| 296 | + # or if the certificate format is invalid | ||
| 297 | + if ( | ||
| 298 | + "TLS backend doesn't support" not in str(e) | ||
| 299 | + and "invalid" not in str(e).lower() | ||
| 300 | + ): | ||
| 301 | + raise | ||
| 299 | 302 | ||
| 300 | 303 | ||
| 301 | 304 | def test_mwindow_file_limit() -> None: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments