Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Fizzadar/JsonTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JsonTest

JsonTest is a tiny metaclass designed for automatically generating tests based off JSON files. Originally built for testing ElasticQuery. Install with pip install jsontest.

Synopsis

from jsontest import JsonTest

class MyTests(TestCase):
    # Set the metaclass to JsonTest
    __metaclass__ = JsonTest

    # Tell JsonTest where to find our JSON files
    jsontest_files = path.join('tests', 'filters')

    # Optional prefix for the test names
    jsontest_prefix = 'test_'

    # Define a function to run against each file
    def jsontest_function(self, test_name, test_data):
        print(test_name, test_data)
        self.assertFalse(False)

About

Automatically generate Python tests from JSON files

Resources

License

Stars

Watchers

Forks

Packages

No packages published