def runtests(argv: List[str], m: str, mark: bool) -> None: """ Literally just prepare the DB and then invoke pytest. """ args = argv.copy() if mark: if args and not args[0].startswith('-'): to_find = args.pop(0) args.extend(find_files(to_find, 'py')) args.extend(['-x', '-m', m]) argstr = ' '.join(args) print(f'>>>> Running tests with "{argstr}"') # pylint: disable=import-outside-toplevel import pytest from magic import fetcher, multiverse, oracle multiverse.init() oracle.init() try: fetcher.sitemap() except fetcher.FetchException: print(f'Config was pointed at {fetcher.decksite_url()}, but it doesnt appear to be listening.') for k in ['decksite_hostname', 'decksite_port', 'decksite_protocol']: configuration.CONFIG[k] = configuration.DEFAULTS[k] code = pytest.main(args) if os.environ.get('TRAVIS') == 'true': upload_coverage() if code: raise TestFailedException(code)
def site_resources(args: str) -> Dict[str, str]: results = {} match = re.match('^s? ?([0-9]*|all) +', args) if match: season_prefix = 'seasons/' + match.group(1) args = args.replace(match.group(0), '', 1).strip() else: season_prefix = '' if ' ' in args: area, detail = args.split(' ', 1) else: area, detail = args, '' if area == 'archetype': area = 'archetypes' if area == 'card': area = 'cards' if area == 'person': area = 'people' sitemap = fetcher.sitemap() matches = [ endpoint for endpoint in sitemap if endpoint.startswith('/{area}/'.format(area=area)) ] if len(matches) > 0: detail = '{detail}/'.format( detail=fetcher.internal.escape(detail, True)) if detail else '' url = fetcher.decksite_url('{season_prefix}/{area}/{detail}'.format( season_prefix=season_prefix, area=fetcher.internal.escape(area), detail=detail)) results[url] = args return results
def site_resources(args): results = {} if ' ' in args.strip(): area, detail = args.strip().split(' ', 1) else: area, detail = args.strip(), '' if area == 'card': area = 'cards' if area == 'person': area = 'people' sitemap = fetcher.sitemap() matches = [endpoint for endpoint in sitemap if endpoint.startswith('/{area}/'.format(area=area))] if len(matches) > 0: url = fetcher.decksite_url('/{area}/{detail}/'.format(area=fetcher.internal.escape(area), detail=fetcher.internal.escape(detail))) results[url] = args return results