How to use the getgauge.registry.registry.is_implemented function in getgauge

To help you get started, we’ve selected a few getgauge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getgauge / gauge-python / tests / test_static_loader.py View on Github external
def test_loader_reload_registry_for_given_content(self):
        content = dedent("""
            @step("print hello")
            def printf():
                print("hello")
            """)
        load_steps(PythonFile.parse("foo.py", content))

        self.assertTrue(registry.is_implemented("print hello"))

        content = dedent("""
                @step("print world")
                def printf():
                    print("hello")
                """)

        reload_steps('foo.py', content)

        self.assertFalse(registry.is_implemented("print hello"))
        self.assertTrue(registry.is_implemented("print world"))
github getgauge / gauge-python / tests / test_processor.py View on Github external
self.load_content_steps('''\
        from getgauge.python import step

        @step('foo ')
        def foo():
            pass
        ''')

        self.assertEqual(registry.is_implemented('foo {}'), True)

        request.filePath = 'foo.py'
        request.status = CacheFileRequest.CREATED
        self.fs.create_file('foo.py')
        processor.process_cache_file_request(request)

        self.assertEqual(registry.is_implemented('foo {}'), True)
github getgauge / gauge-python / tests / test_static_loader.py View on Github external
def test_loader_non_string_argument(self):
        content = dedent("""
            @step(100)
            def printf(arg1):
                print(arg1)
            """)
        load_steps(PythonFile.parse("foo.py", content))

        self.assertFalse(registry.is_implemented("print hello {}"))
github getgauge / gauge-python / tests / test_processor.py View on Github external
''')

        request.filePath = 'foo.py'
        request.content = dedent('''\
        from getgauge.python import step

        @step('foo ')
        def foo():
            pass
        ''')
        request.status = CacheFileRequest.CHANGED

        processor.process_cache_file_request(request)

        self.assertEqual(registry.is_implemented('foo1'), False)
        self.assertEqual(registry.is_implemented('foo {}'), True)
github getgauge / gauge-python / tests / test_static_loader.py View on Github external
def test_loader_reload_registry_for_given_content_with_empty_arg(self):
        content = dedent("""
            @step("print hello <>")
            def printf(arg1):
                print(arg1)
            """)
        load_steps(PythonFile.parse("foo.py", content))

        self.assertTrue(registry.is_implemented("print hello {}"))
github getgauge / gauge-python / tests / test_static_loader.py View on Github external
print("hello")
            """)
        load_steps(PythonFile.parse("foo.py", content))

        self.assertTrue(registry.is_implemented("print hello"))

        content = dedent("""
                @step("print world")
                def printf():
                    print("hello")
                """)

        reload_steps('foo.py', content)

        self.assertFalse(registry.is_implemented("print hello"))
        self.assertTrue(registry.is_implemented("print world"))
github getgauge / gauge-python / tests / test_processor.py View on Github external
''')

        request.filePath = 'foo.py'
        request.content = dedent('''\
        from getgauge.python import step

        @step('foo ')
        def foo():
            pass
        ''')
        request.status = CacheFileRequest.OPENED

        processor.process_cache_file_request(request)

        self.assertEqual(registry.is_implemented('foo1'), False)
        self.assertEqual(registry.is_implemented('foo {}'), True)
github getgauge / gauge-python / tests / test_static_loader.py View on Github external
        @step("print hello")
        def printf():
            print("hello")


        @hello("some other decorator")
        @step("print .")
        def print_word(word):
            print(word)

        """)
        load_steps(PythonFile.parse("foo.py", content))

        self.assertTrue(registry.is_implemented("print hello"))
        self.assertTrue(registry.is_implemented("print {}."))
        self.assertFalse(registry.is_implemented("some other decorator"))
github getgauge / gauge-python / getgauge / validator.py View on Github external
def validate_step(request):
    response = StepValidateResponse()
    response.isValid = True
    if registry.is_implemented(request.stepText) is False:
        response.errorType = StepValidateResponse.STEP_IMPLEMENTATION_NOT_FOUND
        response.errorMessage = 'Step implementation not found'
        response.isValid = False
        response.suggestion = _impl_suggestion(
            request.stepValue)
    elif registry.has_multiple_impls(request.stepText):
        response.isValid = False
        response.errorType = StepValidateResponse.DUPLICATE_STEP_IMPLEMENTATION
        response.suggestion = _duplicate_impl_suggestion(
            request)
    return response