Vimjas / vint

Fast and Highly Extensible Vim script Language Lint implemented in Python.
MIT License
700 stars 33 forks source link

pytest failures with python 3.8 #355

Closed lucianposton closed 4 years ago

lucianposton commented 4 years ago

Tests fail due to python 3.8 warnings that don't show up when byte code is already compiled.

Before running tests, clear out byte code and disable it for future test runs:

find . -name '*.pyc' -delete
export PYTHONDONTWRITEBYTECODE=1
pytest -vv

See test failures caused by 3.8 warnings e.g.:

________________________ TestCLI.test_exec_vint_with_unexistent_file _________________________

self = <test.acceptance.test_cli.TestCLI testMethod=test_exec_vint_with_unexistent_file>

    def test_exec_vint_with_unexistent_file(self):
        cmd = ['bin/vint', '/path/to/unexistent']

        with self.assertRaises(subprocess.CalledProcessError) as context_manager:
            subprocess.check_output(cmd,
                                    stderr=subprocess.STDOUT,
                                    universal_newlines=True)

        got_output = context_manager.exception.output

        expected_output_pattern = r'^vint ERROR:'
>       self.assertRegex(got_output, expected_output_pattern)

test/acceptance/test_cli.py:86: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/acceptance/test_cli.py:11: in assertRegex
    assertRegexpMatches(string, pattern)
E   AssertionError: Regex didn't match: '^vint ERROR:' not found in '/home/worch/vint/vint/ast/plugin/scope_plugin/scope_linker.py:389: SyntaxWarning: "is not" with a literal. Did you mean "!="?\n  is_declared_with_range = attr[\'range\'] is not 0\n/home/worch/vint/vint/ast/plugin/scope_plugin/scope_linker.py:395: SyntaxWarning: "is not" with a literal. Did you mean "!="?\n  is_declared_with_dict = attr[\'dict\'] is not 0 \\\nvint ERROR: no such file or directory: `/path/to/unexistent`\n'
blueyed commented 4 years ago

Thanks for the report. But I guess this is fixed in master (f8bae71), also available as v0.4a2.