Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing the command "cyclonedds typeof" with a derived topic #242

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Testing "cyclonedds typeof" with derived topic

7494072
Select commit
Loading
Failed to load commit list.
Open

Testing the command "cyclonedds typeof" with a derived topic #242

Testing "cyclonedds typeof" with derived topic
7494072
Select commit
Loading
Failed to load commit list.
Azure Pipelines / Build and test failed Apr 2, 2024 in 15m 53s

Build #20240401.1 had test failures

Details

Tests

  • Failed: 8 (0.56%)
  • Passed: 1,420 (98.89%)
  • Other: 8 (0.56%)
  • Total: 1,436
Code coverage

  • 4445 of 9024 lines covered (49.26%)

Annotations

Check failure on line 217 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

Build log #L217

1 test(s) failed, 194 test(s) collected.

Check failure on line 359 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

Build log #L359

Bash exited with code '1'.

Check failure on line 163 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

Build log #L163

1 test(s) failed, 134 test(s) collected.

Check failure on line 346 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

Build log #L346

Bash exited with code '1'.

Check failure on line 1 in tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

@pytest.mark.asyncio
    async def test_cyclonedds_typeof_command():
        '''
        Executes the command "cyclonedds typeof" and compares the results with the
        expected IDL.
        '''
        tasks = [
            _subscriber(Base),
            _subscriber(Derived),
            _type_checker(Base, BASE_IDL),
            _type_checker(Derived, DERIVED_IDL),
        ]
>       await asyncio.gather(*tasks)

test_topic_inheritance.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_topic_inheritance.py:141: in _type_checker
    check = True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

input = None, capture_output = False, timeout = None, check = True
popenargs = (['cyclonedds', 'typeof', 'Base', '--suppress-progress-bar'],)
kwargs = {'stdout': -1}
process = <subprocess.Popen object at 0x00000256EF6E5A48>, stdout = b''
stderr = None, retcode = 1

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communi
Raw output
C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\subprocess.py:512: subprocess.CalledProcessError: Command '['cyclonedds', 'typeof', 'Base', '--suppress-progress-bar']' returned non-zero exit status 1.

Check failure on line 1 in tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

@pytest.mark.asyncio
    async def test_cyclonedds_typeof_command():
        '''
        Executes the command "cyclonedds typeof" and compares the results with the
        expected IDL.
        '''
        tasks = [
            _subscriber(Base),
            _subscriber(Derived),
            _type_checker(Base, BASE_IDL),
            _type_checker(Derived, DERIVED_IDL),
        ]
>       await asyncio.gather(*tasks)

test_topic_inheritance.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

topicClass = Derived(IdlStruct, idl_typename='Hierarchy.Derived')
expectedIdl = 'module Hierarchy { struct Derived : Base { string fieldB; }; };'

    async def _type_checker(topicClass, expectedIdl):
        '''
        Executes the command "cyclonedds typeof" and compares the result with the
        expected IDL.
        '''
        def _normalise(text):
            text = text.replace('\n', '')
            text = ' '.join(text.split())
            return text
    
        import subprocess
        result = subprocess.run(
            ['cyclonedds', 'typeof', topicClass.__name__, '--suppress-progress-bar'],
            stdout = subprocess.PIPE,
            check = True)
        outputLines = result.stdout.decode().splitlines()
    
        # Skips the first lines of the output (As defined in participant...)
        firstIdlLine = 0
        while firstIdlLine < len(outputLines) and not outputLines[firstIdlLine].startswith('module'):
            firstIdlLine += 1
        actualIdl = '\n'.join(outputLines[firstIdlLine:])
    
>       assert _normalise(actualIdl) == _normalise(expectedIdl)
E       AssertionError

test_topic_inheritance.py:150: AssertionError
Raw output
/home/vsts/work/1/s/tests/test_topic_inheritance.py:150: AssertionError

Check failure on line 1 in tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

@pytest.mark.asyncio
    async def test_cyclonedds_typeof_command():
        '''
        Executes the command "cyclonedds typeof" and compares the results with the
        expected IDL.
        '''
        tasks = [
            _subscriber(Base),
            _subscriber(Derived),
            _type_checker(Base, BASE_IDL),
            _type_checker(Derived, DERIVED_IDL),
        ]
>       await asyncio.gather(*tasks)

test_topic_inheritance.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

topicClass = Derived(IdlStruct, idl_typename='Hierarchy.Derived')
expectedIdl = 'module Hierarchy { struct Derived : Base { string fieldB; }; };'

    async def _type_checker(topicClass, expectedIdl):
        '''
        Executes the command "cyclonedds typeof" and compares the result with the
        expected IDL.
        '''
        def _normalise(text):
            text = text.replace('\n', '')
            text = ' '.join(text.split())
            return text
    
        import subprocess
        result = subprocess.run(
            ['cyclonedds', 'typeof', topicClass.__name__, '--suppress-progress-bar'],
            stdout = subprocess.PIPE,
            check = True)
        outputLines = result.stdout.decode().splitlines()
    
        # Skips the first lines of the output (As defined in participant...)
        firstIdlLine = 0
        while firstIdlLine < len(outputLines) and not outputLines[firstIdlLine].startswith('module'):
            firstIdlLine += 1
        actualIdl = '\n'.join(outputLines[firstIdlLine:])
    
>       assert _normalise(actualIdl) == _normalise(expectedIdl)
E       AssertionError

test_topic_inheritance.py:150: AssertionError
Raw output
/home/vsts/work/1/s/tests/test_topic_inheritance.py:150: AssertionError

Check failure on line 1 in tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Build and test

tests/test_topic_inheritance.py::test_cyclonedds_typeof_command

@pytest.mark.asyncio
    async def test_cyclonedds_typeof_command():
        '''
        Executes the command "cyclonedds typeof" and compares the results with the
        expected IDL.
        '''
        tasks = [
            _subscriber(Base),
            _subscriber(Derived),
            _type_checker(Base, BASE_IDL),
            _type_checker(Derived, DERIVED_IDL),
        ]
>       await asyncio.gather(*tasks)

test_topic_inheritance.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

topicClass = Derived(IdlStruct, idl_typename='Hierarchy.Derived')
expectedIdl = 'module Hierarchy { struct Derived : Base { string fieldB; }; };'

    async def _type_checker(topicClass, expectedIdl):
        '''
        Executes the command "cyclonedds typeof" and compares the result with the
        expected IDL.
        '''
        def _normalise(text):
            text = text.replace('\n', '')
            text = ' '.join(text.split())
            return text
    
        import subprocess
        result = subprocess.run(
            ['cyclonedds', 'typeof', topicClass.__name__, '--suppress-progress-bar'],
            stdout = subprocess.PIPE,
            check = True)
        outputLines = result.stdout.decode().splitlines()
    
        # Skips the first lines of the output (As defined in participant...)
        firstIdlLine = 0
        while firstIdlLine < len(outputLines) and not outputLines[firstIdlLine].startswith('module'):
            firstIdlLine += 1
        actualIdl = '\n'.join(outputLines[firstIdlLine:])
    
>       assert _normalise(actualIdl) == _normalise(expectedIdl)
E       AssertionError

test_topic_inheritance.py:150: AssertionError
Raw output
/home/vsts/work/1/s/tests/test_topic_inheritance.py:150: AssertionError