Skip to content

0.13: pytest is failing in 7 units #163

Description

@kloczek

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-cppclean-0.13-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-cppclean-0.13-2.fc35.x86_64/usr/lib/python3.8/site-packages+ /usr/bin/pytest -ra=========================================================================== test session starts ============================================================================platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0rootdir: /home/tkloczko/rpmbuild/BUILD/cppclean-0.13plugins: anyio-3.5.0, tornasync-0.6.0.post2, timeout-2.1.0, cov-3.0.0, black-0.3.12collected 153 itemstest_ast.py .............F.............................F......F..............................FFF....F........................ [ 73%]test_find_warnings.py .. [ 75%]test_symbols.py .......... [ 81%]test_tokenize.py ............................ [100%]================================================================================= FAILURES =================================================================================_______________________________________________________ TypeConverterToParametersTest.test_simple_with_initializers ________________________________________________________self = <test_ast.TypeConverterToParametersTest testMethod=test_simple_with_initializers> def test_simple_with_initializers(self): tokens = get_tokens('Fool* data = NULL') results = self.converter.to_parameters(list(tokens)) self.assertEqual(1, len(results), repr(results)) self.assertEqual([], results[0].type.modifiers) self.assertEqual('Fool', results[0].type.name) self.assertEqual([], results[0].type.templated_types) self.assertEqual(True, results[0].type.pointer) self.assertEqual(False, results[0].type.reference) self.assertEqual(False, results[0].type.array) self.assertEqual('data', results[0].name)
> self.assertEqual([Token('NULL')], results[0].default)E AssertionError: Lists differ: [Token('NULL', 0, 0)] != [Token('NULL', 13, 17)]EE First differing element 0:E Token('NULL', 0, 0)E Token('NULL', 13, 17)EE - [Token('NULL', 0, 0)]E ? ^ ^EE + [Token('NULL', 13, 17)]E ? ^^ ^^test_ast.py:370: AssertionError_____________________________________________ ASTBuilderIntegrationTest.test_class_colon_separated_class_name_and_inline_dtor ______________________________________________self = <test_ast.ASTBuilderIntegrationTest testMethod=test_class_colon_separated_class_name_and_inline_dtor> def test_class_colon_separated_class_name_and_inline_dtor(self): method_body = 'XXX(1) << "should work";' code = 'class Foo::Bar { ~Bar() { %s } };' % method_body nodes = list(MakeBuilder(code).generate()) self.assertEqual(1, len(nodes), repr(nodes)) function = nodes[0].body[0] expected = Function('Bar', [], [], body=list(get_tokens(method_body)), modifiers=ast.FUNCTION_DTOR) self.assertEqual(expected.return_type, function.return_type)
> self.assertEqual(expected, function)E AssertionError: Function(0, 0, None Bar([]), 0x10, [Token('XXX', 0[126 chars]24)]) != Function(18, 21, None Bar([]), 0x10, [Token('XXX',[138 chars]50)])test_ast.py:954: AssertionError________________________________________________________ ASTBuilderIntegrationTest.test_class_handles_struct_rebind ________________________________________________________self = <test_ast.ASTBuilderIntegrationTest testMethod=test_class_handles_struct_rebind> def test_class_handles_struct_rebind(self): code = """ template <typename T, typename Alloc = std::allocator<T> > class AnotherAllocator : public Alloc { template <class U> struct rebind { }; }; """ types1 = {} types1['Alloc'] = (None, list(get_tokens('std::allocator<T>'))) types1['T'] = (None, None) types2 = {} types2['U'] = (None, None) nodes = list(MakeBuilder(code).generate()) self.assertEqual(1, len(nodes), repr(nodes))
> self.assertEqual(Class('AnotherAllocator', bases=[Type('Alloc')], body=[Struct('rebind', body=[], templated_types=types2)], templated_types=types1,), nodes[0])E AssertionError: Class(0, 0, AnotherAllocator<Alloc,T>, [Type(0,[44 chars][])]) != Class(82, 98, AnotherAllocator<T,Alloc>, [Type([54 chars][])])test_ast.py:973: AssertionError________________________________________________ ASTBuilderIntegrationTest.test_method_with_template_class_with2args_works _________________________________________________self = <test_ast.ASTBuilderIntegrationTest testMethod=test_method_with_template_class_with2args_works> def test_method_with_template_class_with2args_works(self): code = """ template <class T, typename U> inline void EVM::VH<T, U>::Write() { } """ nodes = list(MakeBuilder(code).generate()) self.assertEqual(1, len(nodes), repr(nodes)) expected = Method('Write', list(get_tokens('EVM::VH<T, U>')), list(get_tokens('inline void')), [], templated_types={'T': (None, None), 'U': (None, None)}, body=[]) self.assertEqual(expected.return_type, nodes[0].return_type)
> self.assertEqual(expected.in_class, nodes[0].in_class)E AssertionError: Lists differ: [Token('EVM', 0, 3), Token('::', 3, 5), Token('VH', 5, [93 chars] 13)] != [Token('EVM', 60, 63), Token('::', 63, 65), Token('VH',[104 chars] 73)]EE First differing element 0:E Token('EVM', 0, 3)E Token('EVM', 60, 63)EE - [Token('EVM', 0, 3),E + [Token('EVM', 60, 63),E ? + +EE - Token('::', 3, 5),E + Token('::', 63, 65),E ? + +EE - Token('VH', 5, 7),E + Token('VH', 65, 67),E ? + +EE - Token('<', 7, 8),E + Token('<', 67, 68),E ? + +EE - Token('T', 8, 9),E + Token('T', 68, 69),E ? + +EE - Token(',', 9, 10),E ? ^EE + Token(',', 69, 70),E ? + ^EE - Token('U', 11, 12),E ? ^ ^EE + Token('U', 71, 72),E ? ^ ^EE - Token('>', 12, 13)]E ? ^ ^EE + Token('>', 72, 73)]E ? ^ ^test_ast.py:1100: AssertionError________________________________________________ ASTBuilderIntegrationTest.test_method_with_template_class_with3args_works _________________________________________________self = <test_ast.ASTBuilderIntegrationTest testMethod=test_method_with_template_class_with3args_works> def test_method_with_template_class_with3args_works(self): code = """ template <class CT, class IT, class DT> DT* Worker<CT, IT, DT>::Create() { } """ nodes = list(MakeBuilder(code).generate()) self.assertEqual(1, len(nodes), repr(nodes)) tt = (None, None) expected = Method('Create', list(get_tokens('Worker<CT, IT, DT>')), list(get_tokens('DT*')), [], templated_types={'CT': tt, 'IT': tt, 'DT': tt}, body=[]) self.assertEqual(expected.return_type, nodes[0].return_type)
> self.assertEqual(expected.in_class, nodes[0].in_class)E AssertionError: Lists differ: [Token('Worker', 0, 6), Token('<', 6, 7), Token('CT', 7, 9[98 chars] 18)] != [Token('Worker', 61, 67), Token('<', 67, 68), Token('CT', [105 chars] 79)]EE First differing element 0:E Token('Worker', 0, 6)E Token('Worker', 61, 67)EE Diff is 733 characters long. Set self.maxDiff to None to see it.test_ast.py:1118: AssertionError_____________________________________________________ ASTBuilderIntegrationTest.test_method_with_template_class_works ______________________________________________________self = <test_ast.ASTBuilderIntegrationTest testMethod=test_method_with_template_class_works> def test_method_with_template_class_works(self): code = """ template <class T> inline void EVM::VH<T>::Write() { } """ nodes = list(MakeBuilder(code).generate()) self.assertEqual(1, len(nodes), repr(nodes)) expected = Method('Write', list(get_tokens('EVM::VH<T>')), list(get_tokens('inline void')), [], templated_types={'T': (None, None)}, body=[]) self.assertEqual(expected.return_type, nodes[0].return_type)
> self.assertEqual(expected.in_class, nodes[0].in_class)E AssertionError: Lists differ: [Token('EVM', 0, 3), Token('::', 3, 5), Token('VH', 5, [53 chars] 10)] != [Token('EVM', 48, 51), Token('::', 51, 53), Token('VH',[64 chars] 58)]EE First differing element 0:E Token('EVM', 0, 3)E Token('EVM', 48, 51)EE - [Token('EVM', 0, 3),E ? ^ ^EE + [Token('EVM', 48, 51),E ? ^^ ^^EE - Token('::', 3, 5),E ? ---EE + Token('::', 51, 53),E ? +++++EE - Token('VH', 5, 7),E ? ^EE + Token('VH', 53, 55),E ? + ^^EE - Token('<', 7, 8),E ? ^ ^EE + Token('<', 55, 56),E ? ^^ ^^EE - Token('T', 8, 9),E ? ^ ^EE + Token('T', 56, 57),E ? ^^ ^^EE - Token('>', 9, 10)]E ? ^ ^^EE + Token('>', 57, 58)]E ? ^^ ^^test_ast.py:1082: AssertionError_________________________________________________________________ ASTBuilderIntegrationTest.test_operators _________________________________________________________________self = <test_ast.ASTBuilderIntegrationTest testMethod=test_operators> def test_operators(self): for operator in ('=', '+=', '-=', '*=', '==', '!=', '()', '[]', '<', '>', '^=', '<<=', '>>='): code = 'void Foo::operator%s();' % operator nodes = list(MakeBuilder(code).generate()) self.assertEqual(1, len(nodes), repr(nodes))
> self.assertEqual(Method(('operator%s' % operator), list(get_tokens('Foo')), list(get_tokens('void')), []), nodes[0])E AssertionError: Method(0, 0, Type(0, 4, void) operator=([]), 0x00, None) != Method(0, 4, Type(0, 4, void) operator=([]), 0x00, None)test_ast.py:883: AssertionError========================================================================= short test summary info ==========================================================================FAILED test_ast.py::TypeConverterToParametersTest::test_simple_with_initializers - AssertionError: Lists differ: [Token('NULL', 0, 0)] != [Token('NULL', 13, 17)]FAILED test_ast.py::ASTBuilderIntegrationTest::test_class_colon_separated_class_name_and_inline_dtor - AssertionError: Function(0, 0, None Bar([]), 0x10, [Token('XXX', 0...FAILED test_ast.py::ASTBuilderIntegrationTest::test_class_handles_struct_rebind - AssertionError: Class(0, 0, AnotherAllocator<Alloc,T>, [Type(0,[44 chars][])]) != Class...FAILED test_ast.py::ASTBuilderIntegrationTest::test_method_with_template_class_with2args_works - AssertionError: Lists differ: [Token('EVM', 0, 3), Token('::', 3, 5), To...FAILED test_ast.py::ASTBuilderIntegrationTest::test_method_with_template_class_with3args_works - AssertionError: Lists differ: [Token('Worker', 0, 6), Token('<', 6, 7), ...FAILED test_ast.py::ASTBuilderIntegrationTest::test_method_with_template_class_works - AssertionError: Lists differ: [Token('EVM', 0, 3), Token('::', 3, 5), Token('VH', ...FAILED test_ast.py::ASTBuilderIntegrationTest::test_operators - AssertionError: Method(0, 0, Type(0, 4, void) operator=([]), 0x00, None) != Method(0, 4, Type(0, 4, void)...====================================================================== 7 failed, 146 passed in 0.60s =======================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions