예제 #1
0
    def test_chdir_or_cd(self):
        """ tests the chdir or cd method """
        d = Path(self.tempdir)
        cwd = d.getcwd()

        assert str(d) != str(cwd)  # ensure the cwd isn't our tempdir
        d.chdir()  # now, we're going to chdir to tempdir

        assert str(d.getcwd()) == str(self.tempdir)  # we now ensure that our
                                                     # cwd is the tempdir
        d = Path(cwd)  # we're resetting our path

        assert str(d.getcwd()) == str(self.tempdir)  # we ensure that our cwd
                                                     # is still set to tempdir

        d.cd()  # we're calling the alias cd method
        assert str(d.getcwd()) == str(cwd)  # now, we ensure cwd isn'r tempdir
        assert str(d.getcwd()) != str(self.tempdir)
예제 #2
0
    def test_chdir_or_cd(self):
        """ tests the chdir or cd method """
        d = Path(self.tempdir)
        cwd = d.getcwd()

        assert str(d) != str(cwd)  # ensure the cwd isn't our tempdir
        d.chdir()  # now, we're going to chdir to tempdir

        assert str(d.getcwd()) == str(self.tempdir)  # we now ensure that our
        # cwd is the tempdir
        d = Path(cwd)  # we're resetting our path

        assert str(d.getcwd()) == str(self.tempdir)  # we ensure that our cwd
        # is still set to tempdir

        d.cd()  # we're calling the alias cd method
        assert str(d.getcwd()) == str(cwd)  # now, we ensure cwd isn'r tempdir
        assert str(d.getcwd()) != str(self.tempdir)
예제 #3
0
def test():
    from versionclimber.utils import path, clone

    pkgs = Path('pkgs').abspath()

    sklearn = ('scikit-learn', 'scikit-learn')
    openalea = ('openalea', 'openalea')

    if not (pkgs / sklearn[-1]).isdir():
        pkgs.cd()
        clone(*sklearn)
        (pkgs / '..').cd()

    if not (pkgs / openalea[-1]).isdir():
        pkgs.cd()
        clone(*openalea)
        (pkgs / '..').cd()

    _tags = tags('pkgs/scikit-learn')
    print(_tags)

    _versions = list(versions('pkgs/scikit-learn'))
    return _tags, _versions
예제 #4
0
from subprocess import check_call
from webbrowser import open_new_tab

from path import Path  # requires path

repo = Path(__file__).parent.parent
repo.cd()
check_call(['coverage', 'run', '-m', 'pytest'])
check_call(['coverage', 'html'])
open_new_tab(repo / 'htmlcov/index.html')
예제 #5
0
#!/usr/bin/env bash
from subprocess import check_call

from path import Path

wtp_dir = Path(__file__).parent.parent
wtp_dir.cd()
check_call('python setup.py sdist bdist_wheel')
check_call('twine upload dist/*')
for d in ('dist', 'build', 'wikitextparser.egg-info'):
    (wtp_dir / d).rmtree()
예제 #6
0
# run coverage and open the html result
from subprocess import run
from webbrowser import open_new_tab

from path import Path

root = Path(__file__).parent.parent
root.cd()
run(('coverage', 'run', '-m', 'pytest'))
run(('coverage', 'html'))
index = root / "htmlcov/index.html"
open_new_tab(f'file://{index}')
예제 #7
0
from subprocess import check_call
from path import Path  # requires path.py

tests_dir = Path(__file__).parent.parent / 'tests'
tests_dir.cd()
check_call('coverage run __main__.py')
check_call('coverage html')
check_call('python -m webbrowser -t ' + (tests_dir / 'index.html'))