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.

Source Distribution

scratch-dir-1.0.0.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file scratch-dir-1.0.0.tar.gz.

File metadata

  • Download URL: scratch-dir-1.0.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for scratch-dir-1.0.0.tar.gz
Algorithm Hash digest
SHA256 946c327fc508f5c590460f70f418a787960181ff724332f669a84c5e57405f9a
MD5 4d3cc3ee42e2e8b37293679cc53c4001
BLAKE2b-256 03bfdf5bd4c9ba10e86607af608deb450b42f3551645dc63fb7c055c47fd1110

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page