Skip to content

Instantly share code, notes, and snippets.

@theSekyi
Created June 13, 2019 21:33
Show Gist options
  • Select an option

  • Save theSekyi/12594305376938dfab48fd1b86a0bcf0 to your computer and use it in GitHub Desktop.

Select an option

Save theSekyi/12594305376938dfab48fd1b86a0bcf0 to your computer and use it in GitHub Desktop.
'''
1. create user_hash folder
2. create sub_folder by date
3. repeat creating folders
4. see if already created folders return no errors
'''
import unittest
import mock
from utilities import create_folder_for_dataset
class TestFolderExistence(unittest.TestCase):
def test_create_folder_for_dataset_succeed(self,mock_direxists):
import os
def create_folder_for_dataset(user_hash,today):
'''
Function to create folder and subfolder using the user_hash and
current date
'''
if not os.path.exists(f'data/{user_hash}'):
os.makedirs(f'data/{user_hash}',exist_ok=True)
print(f'{user_hash} directory created')
os.makedirs(f'data/{user_hash}/{today}',exist_ok=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment