jolly-good-toolbelt / sphinx_gherkindoc

A tool to convert Gherkin into Sphinx documentation
https://jolly-good-toolbelt.github.io/sphinx_gherkindoc/
11 stars 10 forks source link

test scan tree private and test scan tree exclude seem to have directory ordering test failures. #5

Closed dgou closed 5 years ago

dgou commented 5 years ago

This is under Ubuntu 18.04.2 LTS Python 3.7.3 Testing latest master, commit:

commit 9d8f1708a4b44d92559849c76e7043776da7cd1f (HEAD -> master, upstream/master)
Merge: 46c7a91 c6cd712
Author: sdutton-personal <shawndutton1@gmail.com>
Date:   Tue Jul 16 08:50:57 2019 -0500

    Merge pull request #4 from bradsbrown/Enhancement.travis_setup

    Enhancement: add travis config

After running env_setup.py, self_check.py, I ran run_tests.py and got these two failures:

___ test_scan_tree_private ___

tree = PosixPath('/tmp/pytest-of-dwp/pytest-0/root0')

def test_scan_tree_private(tree):
    expected_data = [
        files.DirData(tree, ["root0"], ["subdir", "_private_dir"], ["test.feature"]),
        files.DirData(
            tree / "subdir", ["root0", "subdir"], [], ["another_test.feature"]
        ),
        files.DirData(tree / "_private_dir", ["root0", "_private_dir"], [], []),
    ]
  assert files.scan_tree(tree, True, []) == expected_data

E AssertionError: assert [DirData(dir_...st.feature'])] == [DirData(dir_p...[], files=[])] E At index 0 diff: DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['_private_dir', 'subdir'], files=['test.feature']) != DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['subdir', '_private_dir'], files=['test.feature']) E Full diff: E - [DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['_private_dir', 'subdir'], files=['test.feature']), E ? ---------- E + [DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['subdir', '_private_dir'], files=['test.feature']), E ? ++++++++++ E - DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0/_private_dir'), path_list=['root0', '_private_dir'], sub_dirs=[], files=[]), E - DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0/subdir'), path_list=['root0', 'subdir'], sub_dirs=[], files=['another_test.feature'])] E ? ^ E + DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0/subdir'), path_list=['root0', 'subdir'], sub_dirs=[], files=['another_test.feature']), E ? ^ E + DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0/_private_dir'), path_list=['root0', '_private_dir'], sub_dirs=[], files=[])]

tests/test_files.py:155: AssertionError ___ test_scan_tree_exclude ___

tree = PosixPath('/tmp/pytest-of-dwp/pytest-0/root0')

def test_scan_tree_exclude(tree):
    expected_data = [
        files.DirData(tree, ["root0"], ["subdir", "_private_dir"], ["test.feature"]),
        files.DirData(tree / "_private_dir", ["root0", "_private_dir"], [], []),
    ]
  assert files.scan_tree(tree, True, ["*subdir*"]) == expected_data

E AssertionError: assert [DirData(dir_...[], files=[])] == [DirData(dir_p...[], files=[])] E At index 0 diff: DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['_private_dir', 'subdir'], files=['test.feature']) != DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['subdir', '_private_dir'], files=['test.feature']) E Full diff: E - [DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['_private_dir', 'subdir'], files=['test.feature']), E ? ---------- E + [DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0'), path_list=['root0'], sub_dirs=['subdir', '_private_dir'], files=['test.feature']), E ? ++++++++++ E DirData(dir_path=PosixPath('/tmp/pytest-of-dwp/pytest-0/root0/_private_dir'), path_list=['root0', '_private_dir'], sub_dirs=[], files=[])]

tests/test_files.py:163: AssertionError

dgou commented 5 years ago

Looking at the test code, the "expected values" does not match the ordering in scan_tree. I'm not sure if the right thing to do is make the test code grunge around in the scan_tree output and sort it, or sort the results inside of scan_tree itself. It's too late and too long since I looked around that code, but I"m raising the issue so I can get it out of my brain.

brolewis commented 5 years ago

@dgou Can this issue be closed with the merge of #6?

dgou commented 5 years ago

Agree, #6 fixed this.