Whenever someone makes a PR to our graffiti wall, we run a test (with circleCI) to make sure any new .json file in the tags directory is valid (8x8, defined color, a name is provided, etc.). This test is written in python in test.py.
However, if someone accidentally adds their JSON file to the project root directory (and not in the tags directory), the test would not catch it, because the the test only looks at whatever is inside the tags directory.
How to fix this
We need a new test in the test.py file. Add a new method to class TestTags, say def test_tags_in_tags(self), that will loop through the project directory, and ensure there are not JSON files in the top-level project directory. So, get every file that's in the current directory, loop through every file and check to see if the file name ends in .json. If so, then let's just assume that the file is an accidental top-level tail, and let's have the test fail.
Example of this happening
This happened in this PR #50 . They added a emac.json file not in the tags directory, and the tests still passed. I fixed it in this commit f6933bf by just renaming the file to tags/emac.json.
If this doesn't make sense or it's confusing, just lmk! More than happy to explain further or help out a bit 😄
Whenever someone makes a PR to our graffiti wall, we run a test (with circleCI) to make sure any new
.jsonfile in thetagsdirectory is valid (8x8, defined color, a name is provided, etc.). This test is written in python intest.py.However, if someone accidentally adds their JSON file to the project root directory (and not in the
tagsdirectory), the test would not catch it, because the the test only looks at whatever is inside thetagsdirectory.How to fix this
We need a new test in the
test.pyfile. Add a new method toclass TestTags, saydef test_tags_in_tags(self), that will loop through the project directory, and ensure there are not JSON files in the top-level project directory. So, get every file that's in the current directory, loop through every file and check to see if the file name ends in.json. If so, then let's just assume that the file is an accidental top-level tail, and let's have the test fail.Example of this happening
This happened in this PR #50 . They added a
emac.jsonfile not in thetagsdirectory, and the tests still passed. I fixed it in this commit f6933bf by just renaming the file totags/emac.json.If this doesn't make sense or it's confusing, just lmk! More than happy to explain further or help out a bit 😄