Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple fixes #67

Merged
merged 5 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", help="run slow tests")


def random_string(l=5):
return ''.join(random.choice(string.ascii_uppercase) for _ in range(l))
def random_string(len=5):
return ''.join(random.choice(string.ascii_uppercase) for _ in range(len))


@pytest.fixture()
Expand All @@ -56,7 +56,7 @@ def gilt_config_file(temp_dir, request):
fixture = request.param
d = temp_dir
c = d.join(os.extsep.join(('gilt', 'yml')))
c.write(request.getfuncargvalue(fixture))
c.write(request.getfixturevalue(fixture))

return c.strpath

Expand Down
11 changes: 6 additions & 5 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
def test_config(gilt_config_file):
result = config.config(gilt_config_file)
os_split = pytest.helpers.os_split
gilt_root = os.path.basename(config.BASE_WORKING_DIR)

r = result[0]
assert 'https://github.com/retr0h/ansible-etcd.git' == r.git
assert 'master' == r.version
assert 'retr0h.ansible-etcd' == r.name
assert ('.gilt', 'clone', 'retr0h.ansible-etcd') == os_split(r.src)[-3:]
assert ('.gilt', 'lock',
assert (gilt_root, 'clone', 'retr0h.ansible-etcd') == os_split(r.src)[-3:]
assert (gilt_root, 'lock',
'retr0h.ansible-etcd') == os_split(r.lock_file)[-3:]
assert ('roles', 'retr0h.ansible-etcd', '') == os_split(r.dst)[-3:]
assert [] == r.files
Expand All @@ -51,7 +52,7 @@ def test_config(gilt_config_file):
assert r.dst is None

f = r.files[0]
x = ('.gilt', 'clone', 'lorin.openstack-ansible-modules', '*_manage')
x = (gilt_root, 'clone', 'lorin.openstack-ansible-modules', '*_manage')
assert x == os_split(f.src)[-4:]
assert ('library', '') == os_split(f.dst)[-2:]

Expand Down Expand Up @@ -189,8 +190,8 @@ def test_get_dst_dir(temp_dir):

def test_get_clone_dir():
parts = pytest.helpers.os_split(config._get_clone_dir())

assert ('.gilt', 'clone') == parts[-2:]
gilt_root = os.path.basename(config.BASE_WORKING_DIR)
assert (gilt_root, 'clone') == parts[-2:]


def test_makedirs(temp_dir):
Expand Down
14 changes: 5 additions & 9 deletions test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@

from gilt import git

slow = pytest.mark.skipif(
not pytest.config.getoption("--runslow"),
reason="need --runslow option to run")


@slow
@pytest.mark.slow
def test_clone(temp_dir):
name = 'retr0h.ansible-etcd'
repo = 'https://github.com/retr0h/ansible-etcd.git'
Expand All @@ -44,7 +40,7 @@ def test_clone(temp_dir):
assert os.path.exists(destination)


@slow
@pytest.mark.slow
def test_extract(temp_dir):
name = 'retr0h.ansible-etcd'
repo = 'https://github.com/retr0h/ansible-etcd.git'
Expand All @@ -68,7 +64,7 @@ def test_extract(temp_dir):
assert os.path.exists(giltfile)


@slow
@pytest.mark.slow
def test_overlay(mocker, temp_dir):
name = 'lorin.openstack-ansible-modules'
repo = 'https://github.com/lorin/openstack-ansible-modules.git'
Expand Down Expand Up @@ -99,7 +95,7 @@ def test_overlay(mocker, temp_dir):
assert 2 == len(glob.glob('{}/*'.format(os.path.join(dst_dir, 'tests'))))


@slow
@pytest.mark.slow
def test_overlay_existing_directory(mocker, temp_dir):
name = 'lorin.openstack-ansible-modules'
repo = 'https://github.com/lorin/openstack-ansible-modules.git'
Expand Down Expand Up @@ -208,7 +204,7 @@ def test_get_version_needs_pull(mocker, patched_run_command):
assert expected == patched_run_command.mock_calls


@slow
@pytest.mark.slow
def test_has_version(temp_dir):
name = 'retr0h.ansible-etcd'
repo = 'https://github.com/retr0h/ansible-etcd.git'
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ deps =
-rrequirements.txt
-rtest-requirements.txt
commands =
unit: py.test --runslow -vv --cov-report=term-missing --cov={toxinidir}/gilt/ --no-cov-on-fail {posargs}
unit: py.test --runslow -vv {posargs}
lint: flake8

[testenv:format]
Expand Down