collab-uniba / pynblint

Pynblint is a linter for Python Jupyter notebooks.
MIT License
40 stars 2 forks source link

Test detection of `.git` directory in a repo #73

Open louieQ opened 2 years ago

louieQ commented 2 years ago

Concerning the recommendation of putting notebooks under version control, at present we detect the use of git.

However, we only have a test case for the absence of the .git directory in a repository. I cannot find a way to put a dummy .git folder in one of the fixture repositories and have it versioned by git in the pynblint repo. I have tried to create a .git folder containing just an empty .touch file in pynblint/tests/fixtures/test_repo/DuplicatesNoUntitled, but it gets ignored even if I explicitly negate the corresponding path in .gitignore.

TODO: find a way to put a dummy .git directory under version control and add a positive case to the test function test_is_versioned.

@pytest.mark.parametrize("test_input,expected", [
    ("UntitledNoDuplicates", False)
])
def test_is_versioned(test_input, expected, repos):
    assert repos[test_input].versioned == expected