Skip to main content

Unit test mixin which creates a scratch directory

Project description

Unit test mixin which creates a scratch director. Sets self.scratch_dir on initialization, and deletes it when finished.

import unittest
from scratch_dir import ScratchDirMixin

class TestThing(CreateScratchDirectoryMixin, unittest.TestCase):
    def setUp(self):
        import json
        import os

        super(TestThing, self).setUp()

        self.local_json_file = self.get_tmp_path('example.json')
        json.dump({'a': 42}, self.local_json_file)

        print 'Example file written to scratch dir: {}'.format(self.scratch_dir)

Development

pip install -r requirements_dev.txt
rake lint

Contribute

Pull requests welcome!

Support

If you are having issues, please let us know.

License

The project is licensed under the two-clause BSD license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for scratch-dir, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size scratch-dir-1.0.0.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page