@@ -67,7 +67,7 @@ def test_enable_caching() -> None:
67
67
# Verify the method exists and accepts boolean values without raising
68
68
assert hasattr (pygit2 .settings , 'enable_caching' )
69
69
assert callable (pygit2 .settings .enable_caching )
70
-
70
+
71
71
# Should not raise exceptions
72
72
pygit2 .settings .enable_caching (False )
73
73
pygit2 .settings .enable_caching (True )
@@ -77,7 +77,7 @@ def test_disable_pack_keep_file_checks() -> None:
77
77
"""Test disable pack keep file checks"""
78
78
assert hasattr (pygit2 .settings , 'disable_pack_keep_file_checks' )
79
79
assert callable (pygit2 .settings .disable_pack_keep_file_checks )
80
-
80
+
81
81
# Should not raise exceptions
82
82
pygit2 .settings .disable_pack_keep_file_checks (False )
83
83
pygit2 .settings .disable_pack_keep_file_checks (True )
@@ -96,26 +96,34 @@ def test_cache_max_size() -> None:
96
96
pygit2 .settings .cache_max_size (original_max_size )
97
97
98
98
99
- @pytest .mark .parametrize ("object_type,test_size,default_size" , [
100
- (ObjectType .BLOB , 2 * 1024 , 0 ),
101
- (ObjectType .COMMIT , 8 * 1024 , 4096 ),
102
- (ObjectType .TREE , 8 * 1024 , 4096 ),
103
- (ObjectType .TAG , 8 * 1024 , 4096 ),
104
- (ObjectType .BLOB , 0 , 0 ),
105
- ])
106
- def test_cache_object_limit (object_type : ObjectType , test_size : int , default_size : int ) -> None :
99
+ @pytest .mark .parametrize (
100
+ 'object_type,test_size,default_size' ,
101
+ [
102
+ (ObjectType .BLOB , 2 * 1024 , 0 ),
103
+ (ObjectType .COMMIT , 8 * 1024 , 4096 ),
104
+ (ObjectType .TREE , 8 * 1024 , 4096 ),
105
+ (ObjectType .TAG , 8 * 1024 , 4096 ),
106
+ (ObjectType .BLOB , 0 , 0 ),
107
+ ],
108
+ )
109
+ def test_cache_object_limit (
110
+ object_type : ObjectType , test_size : int , default_size : int
111
+ ) -> None :
107
112
"""Test set cache object limit"""
108
113
assert callable (pygit2 .settings .cache_object_limit )
109
-
114
+
110
115
pygit2 .settings .cache_object_limit (object_type , test_size )
111
116
pygit2 .settings .cache_object_limit (object_type , default_size )
112
117
113
118
114
- @pytest .mark .parametrize ("level,test_path" , [
115
- (ConfigLevel .GLOBAL , '/tmp/test_global' ),
116
- (ConfigLevel .XDG , '/tmp/test_xdg' ),
117
- (ConfigLevel .SYSTEM , '/tmp/test_system' ),
118
- ])
119
+ @pytest .mark .parametrize (
120
+ 'level,test_path' ,
121
+ [
122
+ (ConfigLevel .GLOBAL , '/tmp/test_global' ),
123
+ (ConfigLevel .XDG , '/tmp/test_xdg' ),
124
+ (ConfigLevel .SYSTEM , '/tmp/test_system' ),
125
+ ],
126
+ )
119
127
def test_search_path (level : ConfigLevel , test_path : str ) -> None :
120
128
"""Test get/set search paths"""
121
129
original = pygit2 .settings .search_path [level ]
@@ -209,7 +217,7 @@ def test_server_timeouts() -> None:
209
217
try :
210
218
pygit2 .settings .server_connect_timeout = 5000
211
219
assert pygit2 .settings .server_connect_timeout == 5000
212
-
220
+
213
221
pygit2 .settings .server_timeout = 10000
214
222
assert pygit2 .settings .server_timeout == 10000
215
223
finally :
@@ -223,7 +231,7 @@ def test_extensions() -> None:
223
231
try :
224
232
test_extensions = ['objectformat' , 'worktreeconfig' ]
225
233
pygit2 .settings .set_extensions (test_extensions )
226
-
234
+
227
235
new_extensions = pygit2 .settings .extensions
228
236
for ext in test_extensions :
229
237
assert ext in new_extensions
@@ -232,37 +240,40 @@ def test_extensions() -> None:
232
240
pygit2 .settings .set_extensions (original )
233
241
234
242
235
- @pytest .mark .parametrize ("method_name,default_value" , [
236
- ('enable_strict_object_creation' , True ),
237
- ('enable_strict_symbolic_ref_creation' , True ),
238
- ('enable_ofs_delta' , True ),
239
- ('enable_fsync_gitdir' , False ),
240
- ('enable_strict_hash_verification' , True ),
241
- ('enable_unsaved_index_safety' , False ),
242
- ('enable_http_expect_continue' , False ),
243
- ])
243
+ @pytest .mark .parametrize (
244
+ 'method_name,default_value' ,
245
+ [
246
+ ('enable_strict_object_creation' , True ),
247
+ ('enable_strict_symbolic_ref_creation' , True ),
248
+ ('enable_ofs_delta' , True ),
249
+ ('enable_fsync_gitdir' , False ),
250
+ ('enable_strict_hash_verification' , True ),
251
+ ('enable_unsaved_index_safety' , False ),
252
+ ('enable_http_expect_continue' , False ),
253
+ ],
254
+ )
244
255
def test_enable_methods (method_name : str , default_value : bool ) -> None :
245
256
"""Test various enable methods"""
246
257
assert hasattr (pygit2 .settings , method_name )
247
258
method = getattr (pygit2 .settings , method_name )
248
259
assert callable (method )
249
-
260
+
250
261
method (True )
251
262
method (False )
252
263
method (default_value )
253
264
254
265
255
- @pytest .mark .parametrize (" priority" , [1 , 5 , 10 , 0 , - 1 , - 2 ])
266
+ @pytest .mark .parametrize (' priority' , [1 , 5 , 10 , 0 , - 1 , - 2 ])
256
267
def test_odb_priorities (priority : int ) -> None :
257
268
"""Test setting ODB priorities"""
258
269
assert hasattr (pygit2 .settings , 'set_odb_packed_priority' )
259
270
assert hasattr (pygit2 .settings , 'set_odb_loose_priority' )
260
271
assert callable (pygit2 .settings .set_odb_packed_priority )
261
272
assert callable (pygit2 .settings .set_odb_loose_priority )
262
-
273
+
263
274
pygit2 .settings .set_odb_packed_priority (priority )
264
275
pygit2 .settings .set_odb_loose_priority (priority )
265
-
276
+
266
277
pygit2 .settings .set_odb_packed_priority (1 )
267
278
pygit2 .settings .set_odb_loose_priority (2 )
268
279
@@ -271,7 +282,7 @@ def test_ssl_methods() -> None:
271
282
"""Test SSL-related methods"""
272
283
assert callable (pygit2 .settings .set_ssl_ciphers )
273
284
assert callable (pygit2 .settings .add_ssl_x509_cert )
274
-
285
+
275
286
ssl_ciphers_supported = True
276
287
try :
277
288
pygit2 .settings .set_ssl_ciphers ('DEFAULT' )
@@ -280,26 +291,26 @@ def test_ssl_methods() -> None:
280
291
if "tls backend doesn't support" not in msg :
281
292
raise
282
293
ssl_ciphers_supported = False
283
-
284
- test_cert = " -----BEGIN CERTIFICATE-----\n MIIB...\n -----END CERTIFICATE-----"
294
+
295
+ test_cert = ' -----BEGIN CERTIFICATE-----\n MIIB...\n -----END CERTIFICATE-----'
285
296
x509_cert_supported = True
286
297
try :
287
298
pygit2 .settings .add_ssl_x509_cert (test_cert )
288
299
except pygit2 .GitError as e :
289
300
msg = str (e ).lower ()
290
301
if (
291
302
"tls backend doesn't support" not in msg
292
- and " invalid" not in msg
293
- and " failed to add raw x509 certificate" not in msg
303
+ and ' invalid' not in msg
304
+ and ' failed to add raw x509 certificate' not in msg
294
305
):
295
306
raise
296
307
x509_cert_supported = False
297
-
308
+
298
309
# At least verify the methods exist even if not supported
299
310
assert not ssl_ciphers_supported or not x509_cert_supported or True
300
311
301
312
302
- @pytest .mark .skipif (sys .platform != " win32" , reason = " Windows-specific feature" )
313
+ @pytest .mark .skipif (sys .platform != ' win32' , reason = ' Windows-specific feature' )
303
314
def test_windows_sharemode () -> None :
304
315
"""Test get/set Windows share mode"""
305
316
original = pygit2 .settings .windows_sharemode
@@ -309,4 +320,4 @@ def test_windows_sharemode() -> None:
309
320
pygit2 .settings .windows_sharemode = 2
310
321
assert pygit2 .settings .windows_sharemode == 2
311
322
finally :
312
- pygit2 .settings .windows_sharemode = original
323
+ pygit2 .settings .windows_sharemode = original
0 commit comments