How to use the pypistats.CACHE_DIR function in pypistats

To help you get started, we’ve selected a few pypistats examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hugovk / pypistats / tests / test_pypistats_cache.py View on Github external
def tearDown(self):
        # Reset original
        pypistats.CACHE_DIR = self.original_cache_dir
github hugovk / pypistats / tests / test_pypistats_cache.py View on Github external
def test__clear_cache(self):
        # Arrange
        # Create old cache file
        cache_file = pypistats.CACHE_DIR / "2018-11-26-old-cache-file.json"
        pypistats._save_cache(cache_file, data={})
        self.assertTrue(cache_file.exists())

        # Act
        pypistats._clear_cache()

        # Assert
        self.assertFalse(cache_file.exists())
github hugovk / pypistats / tests / test_pypistats_cache.py View on Github external
def setUp(self):
        # Choose a new cache dir that doesn't exist
        self.original_cache_dir = pypistats.CACHE_DIR
        self.temp_dir = tempfile.TemporaryDirectory()
        pypistats.CACHE_DIR = Path(self.temp_dir.name) / "pypistats"
github hugovk / pypistats / tests / test_pypistats_cache.py View on Github external
def setUp(self):
        # Choose a new cache dir that doesn't exist
        self.original_cache_dir = pypistats.CACHE_DIR
        self.temp_dir = tempfile.TemporaryDirectory()
        pypistats.CACHE_DIR = Path(self.temp_dir.name) / "pypistats"