aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-13 17:40:01 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-13 17:40:01 -0500
commit23acded468ee550b6dd8808f01423d012aa7e004 (patch)
tree29bb6f0f8a7795302042aa910dbecf59e092432d
parentef84096cd12811e57207f24e96beb86997eb036e (diff)
downloaddotfiles-23acded468ee550b6dd8808f01423d012aa7e004.tar.gz
dotfiles-23acded468ee550b6dd8808f01423d012aa7e004.tar.bz2
dotfiles-23acded468ee550b6dd8808f01423d012aa7e004.zip
Fix cli unit test override
This was not my first choice, but it works. I need to put this in a fixture so it's not duplicated for every cli test function.
-rw-r--r--test_dotfiles.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/test_dotfiles.py b/test_dotfiles.py
index 2b93de6..bdb3439 100644
--- a/test_dotfiles.py
+++ b/test_dotfiles.py
@@ -5,11 +5,14 @@ from dotfiles import Repository, Dotfile, cli
class TestCli(object):
- @pytest.mark.xfail(reason='global overrides not working')
def test_status(self, runner, repo, home, monkeypatch):
- # FIXME: this approach does not work
- monkeypatch.setattr('dotfiles.DEFAULT_HOMEDIR', str(home))
- monkeypatch.setattr('dotfiles.DEFAULT_REPO_PATH', str(repo))
+
+ def repo_init(self, *args, **kwargs):
+ self.ignore = []
+ self.homedir = home
+ self.repodir = repo.ensure(dir=1)
+
+ monkeypatch.setattr(Repository, '__init__', repo_init)
result = runner.invoke(cli, ['status'])
assert not result.exception