19
19
secure_write , is_hidden , is_file_hidden
20
20
)
21
21
22
- from .mocking import darwin , windows , linux
22
+ from .mocking import darwin , linux
23
23
24
24
pjoin = os .path .join
25
25
36
36
'XDG_RUNTIME_DIR' : '' ,
37
37
})
38
38
39
- appdata = patch .dict ('os.environ' , {'APPDATA' : 'appdata' })
40
-
41
39
no_config_env = patch .dict ('os.environ' , {
42
40
'JUPYTER_CONFIG_DIR' : '' ,
43
41
'JUPYTER_DATA_DIR' : '' ,
50
48
51
49
52
50
def realpath (path ):
53
- return os .path .realpath (os .path .expanduser (path ))
51
+ return os .path .abspath ( os . path . realpath (os .path .expanduser (path ) ))
54
52
55
53
home_jupyter = realpath ('~/.jupyter' )
56
54
@@ -65,6 +63,7 @@ def test_envset():
65
63
assert not paths .envset (f"FOO_{ v } " )
66
64
assert not paths .envset ("THIS_VARIABLE_SHOULD_NOT_BE_SET" )
67
65
66
+ @pytest .mark .skipif (sys .platform == "win32" , reason = "does not run on windows" )
68
67
def test_config_dir_darwin ():
69
68
with darwin , no_config_env :
70
69
config = jupyter_config_dir ()
@@ -74,23 +73,24 @@ def test_config_dir_darwin():
74
73
config = jupyter_config_dir ()
75
74
assert config == jupyter_config_env
76
75
77
-
76
+ @ pytest . mark . skipif ( sys . platform != "win32" , reason = "only run on windows" )
78
77
def test_config_dir_windows ():
79
- with windows , no_config_env :
78
+ with no_config_env :
80
79
config = jupyter_config_dir ()
81
80
assert config == home_jupyter
82
81
83
- with windows , config_env :
82
+ with config_env :
84
83
config = jupyter_config_dir ()
85
84
assert config == jupyter_config_env
86
85
87
86
87
+ @pytest .mark .skipif (sys .platform == "win32" , reason = "does not run on windows" )
88
88
def test_config_dir_linux ():
89
- with windows , no_config_env :
89
+ with linux , no_config_env :
90
90
config = jupyter_config_dir ()
91
91
assert config == home_jupyter
92
92
93
- with windows , config_env :
93
+ with linux , config_env :
94
94
config = jupyter_config_dir ()
95
95
assert config == jupyter_config_env
96
96
@@ -102,6 +102,7 @@ def test_data_dir_env():
102
102
assert data == data_env
103
103
104
104
105
+ @pytest .mark .skipif (sys .platform == "win32" , reason = "does not run on windows" )
105
106
def test_data_dir_darwin ():
106
107
with darwin :
107
108
data = jupyter_data_dir ()
@@ -112,18 +113,18 @@ def test_data_dir_darwin():
112
113
data = jupyter_data_dir ()
113
114
assert data == realpath ('~/Library/Jupyter' )
114
115
115
-
116
+ @ pytest . mark . skipif ( sys . platform != "win32" , reason = "only run on windows" )
116
117
def test_data_dir_windows ():
117
- with windows , appdata :
118
- data = jupyter_data_dir ()
119
- assert data == pjoin ('appdata' , 'jupyter' )
118
+ data = jupyter_data_dir ()
119
+ assert data == realpath (pjoin (os .environ .get ('APPDATA' , None ), 'jupyter' ))
120
120
121
- with windows , appdata , xdg :
121
+ with xdg :
122
122
# windows should ignore xdg
123
123
data = jupyter_data_dir ()
124
- assert data == pjoin ('appdata ' , 'jupyter' )
124
+ assert data == realpath ( pjoin (os . environ . get ( 'APPDATA ' , None ), 'jupyter' ) )
125
125
126
126
127
+ @pytest .mark .skipif (sys .platform == "win32" , reason = "does not run on windows" )
127
128
def test_data_dir_linux ():
128
129
with linux , no_xdg :
129
130
data = jupyter_data_dir ()
@@ -141,6 +142,7 @@ def test_runtime_dir_env():
141
142
assert runtime == rtd_env
142
143
143
144
145
+ @pytest .mark .skipif (sys .platform == "win32" , reason = "does not run on windows" )
144
146
def test_runtime_dir_darwin ():
145
147
with darwin :
146
148
runtime = jupyter_runtime_dir ()
@@ -151,18 +153,18 @@ def test_runtime_dir_darwin():
151
153
runtime = jupyter_runtime_dir ()
152
154
assert runtime == realpath ('~/Library/Jupyter/runtime' )
153
155
154
-
156
+ @ pytest . mark . skipif ( sys . platform != "win32" , reason = "only run on windows" )
155
157
def test_runtime_dir_windows ():
156
- with windows , appdata :
157
- runtime = jupyter_runtime_dir ()
158
- assert runtime == pjoin ('appdata' , 'jupyter' , 'runtime' )
158
+ runtime = jupyter_runtime_dir ()
159
+ assert runtime == realpath (pjoin (os .environ .get ('APPDATA' , None ), 'jupyter' , 'runtime' ))
159
160
160
- with windows , appdata , xdg :
161
+ with xdg :
161
162
# windows should ignore xdg
162
163
runtime = jupyter_runtime_dir ()
163
- assert runtime == pjoin ('appdata ' , 'jupyter' , 'runtime' )
164
+ assert runtime == realpath ( pjoin (os . environ . get ( 'APPDATA ' , None ), 'jupyter' , 'runtime' ) )
164
165
165
166
167
+ @pytest .mark .skipif (sys .platform == "win32" , reason = "does not run on windows" )
166
168
def test_runtime_dir_linux ():
167
169
with linux , no_xdg :
168
170
runtime = jupyter_runtime_dir ()
0 commit comments