Fix utmp test
This commit is contained in:
parent
35d4e2d4e0
commit
57152a8e29
@ -1,13 +1,14 @@
|
||||
from sys import platform
|
||||
import subprocess
|
||||
from kitty.fast_data_types import num_users
|
||||
from . import BaseTest
|
||||
|
||||
if platform in ('linux', 'linux2'):
|
||||
import subprocess
|
||||
import re
|
||||
from kitty.fast_data_types import num_users
|
||||
from . import BaseTest
|
||||
|
||||
class UTMPTest(BaseTest):
|
||||
def test_num_users(self):
|
||||
# who -q is the control
|
||||
expected = subprocess.run(['who'], capture_output=True).stdout.decode('utf-8').count('\n')
|
||||
self.ae(num_users(), expected)
|
||||
class UTMPTest(BaseTest):
|
||||
|
||||
def test_num_users(self):
|
||||
# who is the control
|
||||
try:
|
||||
expected = subprocess.check_output(['who']).decode('utf-8').count('\n')
|
||||
except FileNotFoundError:
|
||||
self.skipTest('No who executable cannot verify num_users')
|
||||
self.ae(num_users(), expected)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user