Skip to content

Add a test for accidental top-level tag JSON placement #54

@asg017

Description

@asg017

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 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions