Skip to content
Snippets Groups Projects
Commit aa3bcd7d authored by Alex Kashuba's avatar Alex Kashuba
Browse files

Better None or syntaxis

parent ceed44de
No related tags found
No related merge requests found
......@@ -5,10 +5,7 @@ import sys
def parse_credentials(url):
result = urlparse(url)
if result.username is None:
username = getpass.getuser()
else:
username = result.username
username = result.username or getpass.getuser()
if result.port is None:
hostname = result.hostname
else:
......
......@@ -3,16 +3,17 @@ from pytest import fixture, mark
from main import parse_credentials
import sys, os
@fixture
def ex_whoami(ex_user):
if ex_user is None:
@fixture(scope='session')
def whoami():
if sys.platform == 'darwin':
return os.getenv('USER')
else:
return os.getlogin()
else:
return ex_user
@fixture
def ex_whoami(ex_user, whoami):
return ex_user or whoami
@fixture
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment