fix: resolve pylint and type-checking issues
- Fix return type annotation in SetupRedirectMiddleware.dispatch() to use Response instead of RedirectResponse - Replace broad 'except Exception' with specific exception types (FileNotFoundError, ValueError, OSError, etc.) - Rename AppConfig.validate() to validate_config() to avoid shadowing BaseModel.validate() - Fix ValidationResult.errors field to use List[str] with default_factory - Add pylint disable comments for intentional broad exception catches during shutdown - Rename lifespan parameter to _application to indicate unused variable - Update all callers to use new validate_config() method name
This commit is contained in:
@@ -44,12 +44,12 @@ def test_appconfig_and_config_update_apply_to():
|
||||
def test_backup_and_validation():
|
||||
cfg = AppConfig()
|
||||
# default backups disabled -> valid
|
||||
res: ValidationResult = cfg.validate()
|
||||
res: ValidationResult = cfg.validate_config()
|
||||
assert res.valid is True
|
||||
|
||||
# enable backups but leave path empty -> invalid
|
||||
cfg.backup.enabled = True
|
||||
cfg.backup.path = ""
|
||||
res2 = cfg.validate()
|
||||
res2 = cfg.validate_config()
|
||||
assert res2.valid is False
|
||||
assert any("backup.path" in e for e in res2.errors)
|
||||
|
||||
Reference in New Issue
Block a user