From d66802273eadd43175eeb7c07cf206608e3e7799 Mon Sep 17 00:00:00 2001 From: Dmitry Dygalo Date: Sun, 3 May 2020 16:00:16 +0200 Subject: [PATCH] chore: Remove commented code, add docstrings, remove redundant exception class --- src/schemathesis/cli/options.py | 2 +- src/schemathesis/hooks.py | 16 ++++++++-------- test/cli/test_commands.py | 1 - 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/schemathesis/cli/options.py b/src/schemathesis/cli/options.py index d962039035..79026f8d54 100644 --- a/src/schemathesis/cli/options.py +++ b/src/schemathesis/cli/options.py @@ -36,5 +36,5 @@ def convert( # type: ignore try: int(value) return super().convert(value, param, ctx) - except (ValueError, UnicodeError): + except ValueError: self.fail("%s is not a valid integer or None" % value, param, ctx) diff --git a/src/schemathesis/hooks.py b/src/schemathesis/hooks.py index 2749868dad..0bd2253694 100644 --- a/src/schemathesis/hooks.py +++ b/src/schemathesis/hooks.py @@ -184,42 +184,42 @@ def unregister_all(self) -> None: @all_scopes def before_generate_path_parameters(strategy: st.SearchStrategy, context: HookContext) -> st.SearchStrategy: - pass + """Called on a strategy that generates values for ``path_parameters``.""" @all_scopes def before_generate_headers(strategy: st.SearchStrategy, context: HookContext) -> st.SearchStrategy: - pass + """Called on a strategy that generates values for ``headers``.""" @all_scopes def before_generate_cookies(strategy: st.SearchStrategy, context: HookContext) -> st.SearchStrategy: - pass + """Called on a strategy that generates values for ``cookies``.""" @all_scopes def before_generate_query(strategy: st.SearchStrategy, context: HookContext) -> st.SearchStrategy: - pass + """Called on a strategy that generates values for ``query``.""" @all_scopes def before_generate_body(strategy: st.SearchStrategy, context: HookContext) -> st.SearchStrategy: - pass + """Called on a strategy that generates values for ``body``.""" @all_scopes def before_generate_form_data(strategy: st.SearchStrategy, context: HookContext) -> st.SearchStrategy: - pass + """Called on a strategy that generates values for ``form_data``.""" @all_scopes def before_process_path(context: HookContext, path: str, methods: Dict[str, Any]) -> None: - pass + """Called before API path is processed.""" @HookDispatcher.register_spec([HookScope.GLOBAL]) def before_load_schema(context: HookContext, raw_schema: Dict[str, Any]) -> None: - pass + """Called before schema instance is created.""" GLOBAL_HOOK_DISPATCHER = HookDispatcher(scope=HookScope.GLOBAL) diff --git a/test/cli/test_commands.py b/test/cli/test_commands.py index 1fea034ea5..d6f9ea2788 100644 --- a/test/cli/test_commands.py +++ b/test/cli/test_commands.py @@ -806,7 +806,6 @@ def assert_threaded_executor_interruption(lines, expected, optional_interrupt=Fa if not optional_interrupt: assert "!! KeyboardInterrupt !!" in lines[11] if "F" in lines[10]: - # assert "=== FAILURES ===" in lines[12] if "!! KeyboardInterrupt !!" not in lines[11]: assert "=== FAILURES ===" in lines[12] position = 23