Created
June 13, 2019 21:33
-
-
Save theSekyi/12594305376938dfab48fd1b86a0bcf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| 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): | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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