예제 #1
0
    def register_and_unregister_json(self):
        """Setup & teardown for JSON read/write tests."""
        # Register
        readwrite_registry.register_reader("json", Cosmology, read_json, force=True)
        readwrite_registry.register_writer("json", Cosmology, write_json, force=True)
        readwrite_registry.register_identifier("json", Cosmology, json_identify, force=True)

        yield  # Run all tests in class

        # Unregister
        readwrite_registry.unregister_reader("json", Cosmology)
        readwrite_registry.unregister_writer("json", Cosmology)
        readwrite_registry.unregister_identifier("json", Cosmology)
예제 #2
0
    def setup_readwrite(self):
        """Setup & teardown for read/write tests."""
        # register
        readwrite_registry.register_reader("json", Cosmology, read_json, force=True)
        readwrite_registry.register_writer("json", Cosmology, write_json, force=True)
        readwrite_registry.register_identifier("json", Cosmology, json_identify, force=True)

        yield  # run all tests in class

        # unregister
        readwrite_registry.unregister_reader("json", Cosmology)
        readwrite_registry.unregister_writer("json", Cosmology)
        readwrite_registry.unregister_identifier("json", Cosmology)