Skip to content

Commit

Permalink
Use shell functions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Jan 9, 2017
1 parent 6ef34bb commit 4c5f43b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from freezegun import freeze_time

import gitman
from gitman import shell
from gitman.models import Config
from gitman.exceptions import UncommittedChanges, InvalidRepository

Expand Down Expand Up @@ -283,6 +284,7 @@ def describe_list():
def it_updates_the_log(config):
gitman.install()
gitman.list()

with open(config.log_path) as stream:
contents = stream.read().replace(ROOT, "/tmp").replace('\\', '/')
expect(contents) == strip("""
Expand Down Expand Up @@ -337,18 +339,16 @@ def it_records_specified_dependencies(config):

def it_should_fail_on_dirty_repositories(config):
expect(gitman.update(depth=1, lock=False)) == True
os.remove("deps/gitman_1/.project")
shell.rm(os.path.join("deps", "gitman_1", ".project"))

with pytest.raises(UncommittedChanges):
gitman.lock()

expect(config.__mapper__.text).does_not_contain("<dirty>")

def it_should_fail_on_invalid_repositories(config):
if not os.path.exists("deps"):
os.makedirs("deps")
with open("deps/gitman_1", 'w') as stream:
stream.write("invalid repository")
shell.mkdir("deps")
shell.rm(os.path.join("deps", "gitman_1"))

with pytest.raises(InvalidRepository):
gitman.lock()
Expand Down

0 comments on commit 4c5f43b

Please sign in to comment.