def test_create(self, p_mkdir): ''' Test that the create() method properly creates the .paro directory using os.mkdir. ''' dd = DotDir() dd.create() p_mkdir.assert_called_once_with('.paro')
def test_exists(self, p_exists): ''' Test that the .exists() method directly returns the value of os.path.exists(). ''' dd = DotDir() p_exists.return_value = True self.assertTrue(dd.exists()) p_exists.assert_called_once_with('.paro') p_exists.reset_mock() p_exists.return_value = False self.assertFalse(dd.exists()) p_exists.assert_called_once_with('.paro')
help='Display debug-level information') # Parse arguments args = parser.parse_args() # Initial setup if args.info: logger.setLevel(logging.INFO) if args.warning: logger.setLevel(logging.WARN) # Execute subcommand if args.subcommand == 'init': # Create .paro directory and paro.yaml file try: dotdir = DotDir() dotdir.create() logger.info('Created .paro directory at: %s' % dotdir.path) except errors.DotDirAlreadyExists: logger.error('The .paro directory already exists.') logger.error('Aborting!') exit(1) try: parofile = ParoFile() parofile.create() logger.info('Created paro.yaml file at: %s' % parofile.path) except errors.ParoFileAlreadyExists: logger.error('The paro.yaml file already exists.') logger.error('Aborting!') exit(1)