pax_global_header00006660000000000000000000000064125262201340014507gustar00rootroot0000000000000052 comment=fa6e564d0d3eb2d25d5118e6d1a0d6abf57762d8 JsonTest-1.2/000077500000000000000000000000001252622013400131225ustar00rootroot00000000000000JsonTest-1.2/.gitignore000066400000000000000000000000411252622013400151050ustar00rootroot00000000000000.DS_Store *.pyc dist/ *.egg-info JsonTest-1.2/LICENSE.md000066400000000000000000000020751252622013400145320ustar00rootroot00000000000000Copyright (C) 2015 Nick Barrett Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. JsonTest-1.2/README.md000066400000000000000000000011501252622013400143760ustar00rootroot00000000000000# JsonTest `JsonTest` is a tiny metaclass designed for automatically generating tests based off JSON files. Originally built for testing [`ElasticQuery`](https://github.com/Fizzadar/ElasticQuery). ## Synopsis ```py 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') # Define a function to run against each file def jsontest_function(self, test_name, test_data): print test_name, test_data self.assertFalse(False) ``` JsonTest-1.2/jsontest.py000066400000000000000000000015171252622013400153510ustar00rootroot00000000000000import json from os import listdir, path class JsonTest(type): def __new__(cls, name, bases, attrs): # Get the JSON files files = listdir(attrs['jsontest_files']) files = [f for f in files if f.endswith('.json')] def gen_test(test_name, test_data): def test(self): self.jsontest_function(test_name, test_data) return test # Loop them and create class methods to call the jsontest_function for filename in files: test_name = filename[:-5] test_data = json.loads(open(path.join(attrs['jsontest_files'], filename)).read()) # Attach the method method_name = 'test_{0}'.format(test_name) attrs[method_name] = gen_test(test_name, test_data) return type.__new__(cls, name, bases, attrs) JsonTest-1.2/release.sh000077500000000000000000000002671252622013400151060ustar00rootroot00000000000000#!/bin/sh VERSION=`python setup.py --version` echo "Doing git..." git tag -a v$VERSION -m v$VERSION git push --tags echo "Doing pypi..." python setup.py sdist upload echo "Done!" JsonTest-1.2/setup.py000066400000000000000000000006651252622013400146430ustar00rootroot00000000000000#!/usr/bin/env python # JsonTest # File: setup.py # Desc: needed try: from setuptools import setup except ImportError: from distutils.core import setup setup( version='1.2', name='JsonTest', description='A tiny metaclass for autogenerating tests from JSON files', author='Nick Barrett', author_email='pointlessrambler@gmail.com', url='http://github.com/Fizzadar/JsonTest', py_modules=['jsontest'] )