13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
#
16
- from unittest import TestCase , mock
17
- from contextlib import contextmanager
18
- import hopsworks
19
16
import getpass
20
- import os
21
- import uuid
22
- import tempfile
23
17
import importlib
18
+ import os
24
19
import shutil
20
+ import tempfile
21
+ import uuid
22
+ from contextlib import contextmanager
23
+ from datetime import date
24
+ from unittest import TestCase , mock , skipIf
25
+
26
+ import hopsworks
25
27
from hopsworks .client import exceptions
26
28
from hopsworks .project import Project
27
29
@@ -63,7 +65,6 @@ def tearDown(self):
63
65
hopsworks .logout ()
64
66
65
67
def _check_api_key_existence (self ):
66
-
67
68
path = hopsworks ._get_cached_api_key_path ()
68
69
69
70
api_key_name = ".hw_api_key"
@@ -87,6 +88,7 @@ def _check_api_key_existence(self):
87
88
path == temp_api_key_path ,
88
89
)
89
90
91
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
90
92
def test_login_api_key_as_input (self ):
91
93
# Should accept api key as input from command line
92
94
@@ -106,6 +108,7 @@ def test_login_api_key_as_input(self):
106
108
assert in_home is True and os .path .exists (path )
107
109
assert in_tmp is False
108
110
111
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
109
112
def test_login_api_key_as_argument (self ):
110
113
# Should accept api key as argument
111
114
path , in_cwd , in_home , in_tmp = self ._check_api_key_existence ()
@@ -123,6 +126,7 @@ def test_login_api_key_as_argument(self):
123
126
assert in_home is True and not os .path .exists (path )
124
127
assert in_tmp is False
125
128
129
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
126
130
def test_login_cmd_input_incorrect (self ):
127
131
# Should fail to login with incorrect API key
128
132
@@ -136,6 +140,7 @@ def test_login_cmd_input_incorrect(self):
136
140
with input ({"hidden" : "incorrect_api_key" }):
137
141
hopsworks .login ()
138
142
143
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
139
144
def test_login_fallback_to_tmp (self ):
140
145
# Should fall back to storing api key in tmp folder if home is not write and executable for user
141
146
os .chmod (self .home_dir , 0o400 )
@@ -155,6 +160,7 @@ def test_login_fallback_to_tmp(self):
155
160
assert in_home is False
156
161
assert in_tmp is True and os .path .exists (path )
157
162
163
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
158
164
def test_login_use_cwd_api_key (self ):
159
165
# Should use API key in cwd if exists
160
166
@@ -177,6 +183,7 @@ def test_login_use_cwd_api_key(self):
177
183
assert in_home is False
178
184
assert in_tmp is False
179
185
186
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
180
187
def test_login_use_home_api_key (self ):
181
188
# Should use API key in home if exists
182
189
@@ -202,6 +209,7 @@ def test_login_use_home_api_key(self):
202
209
assert in_home is True and os .path .exists (path )
203
210
assert in_tmp is False
204
211
212
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
205
213
def test_login_api_key_as_environ (self ):
206
214
# Should accept api key as environmet variable
207
215
try :
@@ -226,6 +234,7 @@ def test_login_api_key_as_environ(self):
226
234
finally :
227
235
del os .environ ["HOPSWORKS_API_KEY" ]
228
236
237
+ @skipIf (date .today () <= date (2024 , 7 , 22 ), "Robin is on vacation." )
229
238
def test_login_newline_in_api_key (self ):
230
239
try :
231
240
imaginaryApiKey = "ImaginaryApiKey\n "
0 commit comments