File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1
1
"""Tests for libvcs hg repos."""
2
+ import getpass
2
3
import os
3
4
import pathlib
5
+ import textwrap
4
6
5
7
import pytest
6
8
11
13
pytestmark = pytest .mark .skip (reason = "hg is not available" )
12
14
13
15
16
+ @pytest .fixture (autouse = True , scope = "session" )
17
+ def home_path (tmp_path_factory : pytest .TempPathFactory ):
18
+ return tmp_path_factory .mktemp ("home" )
19
+
20
+
21
+ @pytest .fixture (autouse = True , scope = "session" )
22
+ def user_path (home_path : pathlib .Path ):
23
+ p = home_path / getpass .getuser ()
24
+ p .mkdir ()
25
+ return p
26
+
27
+
28
+ @pytest .fixture (autouse = True , scope = "session" )
29
+ def hg_user_path (user_path : pathlib .Path ):
30
+ hg_config = user_path / ".hg"
31
+ hg_config .mkdir ()
32
+ return hg_config
33
+
34
+
35
+ @pytest .fixture (autouse = True , scope = "session" )
36
+ def hgrc (hg_user_path : pathlib .Path ):
37
+ hgrc = hg_user_path / "hgrc"
38
+ hgrc .write_text (
39
+ textwrap .dedent (
40
+ f"""
41
+ [paths]
42
+ default = { hg_remote }
43
+
44
+ [ui]
45
+ username = libvcs tests <libvcs@git-pull.com>
46
+ merge = internal:merge
47
+
48
+ [trusted]
49
+ users = { getpass .getuser ()}
50
+ """
51
+ ),
52
+ encoding = "utf-8" ,
53
+ )
54
+ return hgrc
55
+
56
+
57
+ @pytest .fixture (autouse = True )
58
+ def hgrc_default (monkeypatch : pytest .MonkeyPatch , hgrc : pathlib .Path ):
59
+ monkeypatch .chdir (hgrc .parent )
60
+
61
+
14
62
@pytest .fixture
15
63
def hg_remote (parentdir ):
16
64
"""Create a git repo with 1 commit, used as a remote."""
You can’t perform that action at this time.
0 commit comments