We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d5c4617 + 846be9d commit f23a984Copy full SHA for f23a984
batchspawner/tests/test_spawners.py
@@ -1,8 +1,11 @@
1
"""Test BatchSpawner and subclasses"""
2
3
import asyncio
4
+import pwd
5
import re
6
import time
7
+from getpass import getuser
8
+from unittest import mock
9
10
import pytest
11
from jupyterhub import orm
@@ -17,6 +20,15 @@
17
20
testport = 54321
18
21
19
22
23
+@pytest.fixture(autouse=True)
24
+def _always_get_my_home():
25
+ # pwd.getbwnam() is always called with the current user
26
+ # ignoring the requested name, which usually doesn't exist
27
+ getpwnam = pwd.getpwnam
28
+ with mock.patch.object(pwd, "getpwnam", lambda name: getpwnam(getuser())):
29
+ yield
30
+
31
32
class BatchDummy(BatchSpawnerRegexStates):
33
exec_prefix = ""
34
batch_submit_cmd = Unicode("cat > /dev/null; echo " + testjob)
0 commit comments