Example #1
0
def gitrepo(request):
    """A test fixutre that creates and destroys a git repo in a temporary directory.
    This will yeild the path to the repo.
    """
    cwd = os.getcwd()
    name = request.node.name
    repo = os.path.join(tempfile.gettempdir(), name)
    if os.path.exists(repo):
        shutil.rmtree(repo)
    subprocess.run(['git', 'init', repo])
    os.chdir(repo)
    with open('README', 'w') as f:
        f.write('testing ' + name)
    subprocess.run(['git', 'add', '.'])
    subprocess.run(['git', 'commit', '-am', 'Initial readme'])
    with environ.context():
        yield repo
    os.chdir(cwd)
    shutil.rmtree(repo)
Example #2
0
           '.. code-block:: python\n\n'
           '    from {fullmodname} import {var}\n\n'
           '{docstr}\n\n'
           '{rever_xsh}\n\n'
           '-------\n\n')
    for var in vars:
        title = var
        under = '.' * len(title)
        act = acts[var][1]
        docstr = inspect.getdoc(act)
        rever_xsh = make_activity_rever_xsh_example(act)
        s += sec.format(var=var,
                        low=var.lower(),
                        under=under,
                        docstr=docstr,
                        fullmodname=acts[var][0],
                        rever_xsh=rever_xsh)
    s = s[:-9]
    fname = os.path.join(os.path.dirname(__file__), 'activitiesbody')
    with open(fname, 'w') as f:
        f.write(s)


with environ.context():
    make_activities()
    make_envvars()

builtins.__xonsh_history__ = None
builtins.__xonsh_env__ = {}
builtins.__xonsh_commands_cache__ = CommandsCache()
Example #3
0
def githubenv(request):
    with environ.context():
        env = builtins.__xonsh_env__
        env['GITHUB_ORG'] = 'wakka'
        env['GITHUB_REPO'] = 'jawaka'
        yield env
Example #4
0
def dockerenv(request):
    with environ.context():
        env = builtins.__xonsh__.env
        yield env