@nottest
def make_fact_tests(fact_name):
    fact = FACTS[fact_name]()

    @six.add_metaclass(JsonTest)
    class TestTests(TestCase):
        jsontest_files = path.join('tests', 'facts', fact_name)

        def jsontest_function(self, test_name, test_data):
            if 'arg' in test_data:
                fact.command(test_data['arg'])

            data = fact.process(test_data['output'])

            # Encode/decode data to ensure datetimes/etc become JSON
            data = json.loads(json.dumps(data, default=json_encode))
            try:
                self.assertEqual(data, test_data['fact'])
            except AssertionError as e:
                print()
                print('--> GOT:\n', json.dumps(data, indent=4, default=json_encode))
                print('--> WANT:', json.dumps(
                    test_data['fact'], indent=4, default=json_encode
                ))
                raise e

    TestTests.__name__ = 'Fact{0}'.format(fact_name)
    return TestTests


# Find available fact tests
dataset/ETHPy150Open Fizzadar/pyinfra/tests/test_facts.py/make_fact_tests/original