def test_build_fail_no_spec_or_src(self): with pytest.raises(SystemExit): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() build_cmd = ['build', '--app-name', 'MyApp', '--clean' '--app-version', '0.1.0', '-F'] parser = get_parser() args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args) b.build()
def test_make_spec(self): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() spec_cmd = [ 'make-spec', 'app.py', '-F', '--app-name', 'MyApp', '--app-version', '0.1.0' ] spec_file_name = get_system() + '.spec' build_cmd = [ 'build', '--app-name', 'MyApp', '--app-version', '0.1.0', spec_file_name ] build_cmd = [str(b) for b in build_cmd] parser = get_parser() with open('app.py', 'w') as f: f.write('print "Hello, World!"') args, pyu_args = parser.parse_known_args(spec_cmd) b = Builder(args, pyu_args) b.make_spec() assert os.path.exists(spec_file_name) args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args) b.build() with ChDir(new_folder): assert len(os.listdir(os.getcwd())) == 1
def test_make_spec(self): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() spec_cmd = ['make-spec', 'app.py', '-F', '--app-name', 'MyApp', '--app-version', '0.1.0'] spec_file_name = get_system() + '.spec' build_cmd = ['build', '--app-name', 'MyApp', '--app-version', '0.1.0', spec_file_name] build_cmd = [str(b) for b in build_cmd] parser = get_parser() with open('app.py', 'w') as f: f.write('print "Hello, World!"') args, pyu_args = parser.parse_known_args(spec_cmd) b = Builder(args, pyu_args) b.make_spec() assert os.path.exists(spec_file_name) args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args) b.build() with ChDir(new_folder): assert len(os.listdir(os.getcwd())) == 1
def test_directory_creation(self): data_dir = os.getcwd() pyu_data_dir = os.path.join(data_dir, 'pyu-data') t_config = TConfig() t_config.DATA_DIR = data_dir pyu = PyUpdater(t_config) pyu.setup() assert os.path.exists(pyu_data_dir) assert os.path.exists(os.path.join(pyu_data_dir, 'deploy')) assert os.path.exists(os.path.join(pyu_data_dir, 'files')) assert os.path.exists(os.path.join(pyu_data_dir, 'new'))
def init(): # pragma: no cover if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER, settings.CONFIG_FILE_USER)): config = Config() config = initial_setup(config) log.info('Creating pyu-data dir...') pyu = PyUpdater(config) pyu.setup() loader = Loader() loader.save_config(config) log.info('Setup complete') else: sys.exit('Not an empty PyUpdater repository')
def init(): # pragma: no cover if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER, settings.CONFIG_FILE_USER)): config = Config() config = initial_setup(config) log.info('Creating pyu-data dir...') pyu = PyUpdater(config) pyu.setup() loader = Loader() loader.save_config(config) log.info('Setup complete') else: sys.exit('Not an empty PyUpdater repository')
def test_build_fail_no_spec_or_src(self): with pytest.raises(SystemExit): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() build_cmd = [ 'build', '--app-name', 'MyApp', '--clean' '--app-version', '0.1.0', '-F' ] parser = get_parser() args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args) b.build()
def test_build_mac_dot_app(self): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() build_cmd = ['build', '-F', '-w', '--app-name', 'MyApp', '--app-version', '0.1.0', 'app.py'] build_cmd = [str(b) for b in build_cmd] parser = get_parser() with open('app.py', 'w') as f: f.write('print "Hello, World!"') args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args) b.build() with ChDir(new_folder): assert len(os.listdir(os.getcwd())) == 1
def test_build(self): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() build_cmd = [ 'build', '--app-name', 'MyApp', '--app-version', '0.1.0', 'app.py' ] build_cmd = [str(b) for b in build_cmd] parser = get_parser() with open('app.py', 'w') as f: f.write('print "Hello, World!"') args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args) b.build() with ChDir(new_folder): assert len(os.listdir(os.getcwd())) == 1
def init(args): # pragma: no cover db = Storage() loader = Loader(db) count = args.count if count > 10: sys.exit('Cannot be more then 10') if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER, settings.CONFIG_FILE_USER)): config = initial_setup(SetupConfig()) log.info('Creating pyu-data dir...') pyu = PyUpdater(config, db) pyu.setup() log.info('Making signing keys...') pyu.make_keys(count) config.PUBLIC_KEYS = pyu.get_public_keys() loader.save_config(config) log.info('Setup complete') db._sync_db() else: sys.exit('Not an empty PyUpdater repository')
def test_build_fail_script_syntax_error(self): with pytest.raises(SystemExit): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() spec_cmd = ['make-spec', 'app.py', '-F'] spec_file_name = get_system() + '.spec' build_cmd = ['build', '--app-name', 'MyApp', '--clean' '--app-version', '0.1.0', spec_file_name] parser = get_parser() with open('app.py', 'w') as f: # Missing closing quote f.write('print "Hello, World!') args, pyu_args = parser.parse_known_args(spec_cmd) b = Builder(args, pyu_args) b.make_spec() assert os.path.exists(spec_file_name) args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args)
def init(args): # pragma: no cover db = Storage() loader = Loader(db) count = args.count if count > 10: sys.exit('Cannot be more then 10') if not os.path.exists( os.path.join(settings.CONFIG_DATA_FOLDER, settings.CONFIG_FILE_USER)): config = initial_setup(SetupConfig()) log.info('Creating pyu-data dir...') pyu = PyUpdater(config, db) pyu.setup() log.info('Making signing keys...') pyu.make_keys(count) config.PUBLIC_KEYS = pyu.get_public_keys() loader.save_config(config) log.info('Setup complete') db._sync_db() else: sys.exit('Not an empty PyUpdater repository')
def _cmd_init(*args): # pragma: no cover if not os.path.exists(os.path.join(settings.CONFIG_DATA_FOLDER, settings.CONFIG_FILE_USER)): # Load a basic config. config = Config() # Run config through all of the setup functions config = initial_setup(config) log.info('Creating pyu-data dir...') # Initialize PyUpdater with newly created config pyu = PyUpdater(config) # Setup repository pyu.setup() # Load config manager & save config to disk cm = ConfigManager() cm.save_config(config) log.info('Setup complete') else: log.error('Not an empty PyUpdater repository')
def _cmd_init(*args): # pragma: no cover if not os.path.exists( os.path.join(settings.CONFIG_DATA_FOLDER, settings.CONFIG_FILE_USER)): # Load a basic config. config = Config() # Run config through all of the setup functions config = initial_setup(config) log.info('Creating pyu-data dir...') # Initialize PyUpdater with newly created config pyu = PyUpdater(config) # Setup repository pyu.setup() # Load config manager & save config to disk cm = ConfigManager() cm.save_config(config) log.info('Setup complete') else: log.error('Not an empty PyUpdater repository')
def test_build_fail_script_syntax_error(self): with pytest.raises(SystemExit): t_config = TConfig() t_config.DATA_DIR = os.getcwd() pyu = PyUpdater(t_config) pyu.setup() spec_cmd = ['make-spec', 'app.py', '-F'] spec_file_name = get_system() + '.spec' build_cmd = [ 'build', '--app-name', 'MyApp', '--clean' '--app-version', '0.1.0', spec_file_name ] parser = get_parser() with open('app.py', 'w') as f: # Missing closing quote f.write('print "Hello, World!') args, pyu_args = parser.parse_known_args(spec_cmd) b = Builder(args, pyu_args) b.make_spec() assert os.path.exists(spec_file_name) args, pyu_args = parser.parse_known_args(build_cmd) b = Builder(args, pyu_args)