-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
addopts = -p no:warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import shutil | ||
import tempfile | ||
import subprocess | ||
|
||
import pytest | ||
|
||
from rever import environ | ||
|
||
|
||
@pytest.fixture | ||
def gitrepo(request): | ||
"""A test fixutre that creates and destroys a git repo in a temporary directory""" | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""Tests logger""" | ||
import os | ||
|
||
from rever.logger import Logger | ||
|
||
|
||
def test_logger(gitrepo): | ||
logger = Logger(os.path.join(gitrepo, 'mylog.json')) | ||
logger.log('sample message', activity="kenny", category="loggin'") | ||
entries = logger.load() | ||
assert len(entries) == 1 |