# Path: typtop/config.py
# SEC_DB_PATH = '/etc/typtop.d'
# 
# DISTRO = set_distro()


import pytest
import pam   # python-pam
import os
import subprocess
import time
    import pwd, grp
    import crypt, shutil
from typtop.config import SEC_DB_PATH, DISTRO
        # We're not root so, like, whatever dude
        return
    # Get the uid/gid from the name
    running_uid = pwd.getpwnam(uid_name).pw_uid
    running_gid = grp.getgrnam(gid_name).gr_gid

    # Remove group privileges
    os.setgroups([])

    # Try setting the new uid/gid
    os.setgid(running_gid)
    os.setuid(running_uid)


def grab_privileges():
    try:
        os.setuid(0)
        os.setgid(0)
    except Exception:
        pass


@pytest.fixture(scope="session", autouse=True)
def pytest_sessionstart(request):
    """ before session.main() is called. """
    pw = crypt.crypt(pws[0], 'ab')
    dbpath = os.path.join(SEC_DB_PATH, user)
    thisdir = os.path.dirname(os.path.abspath(__file__))
    if os.path.exists(dbpath):
        subprocess.Popen("sudo rm -rf {}".format(dbpath), shell=True)

# Path: typtop/config.py
# SEC_DB_PATH = '/etc/typtop.d'
# 
# DISTRO = set_distro()


# Path: tests/test_pam.py
import pytest
import pam   # python-pam
import os
import subprocess
import time
    import pwd, grp
    import crypt, shutil
from typtop.config import SEC_DB_PATH, DISTRO

        # We're not root so, like, whatever dude
        return
    # Get the uid/gid from the name
    running_uid = pwd.getpwnam(uid_name).pw_uid
    running_gid = grp.getgrnam(gid_name).gr_gid

    # Remove group privileges
    os.setgroups([])

    # Try setting the new uid/gid
    os.setgid(running_gid)
    os.setuid(running_uid)


def grab_privileges():
    try:
        os.setuid(0)
        os.setgid(0)
    except Exception:
        pass


@pytest.fixture(scope="session", autouse=True)
def pytest_sessionstart(request):
    """ before session.main() is called. """
    pw = crypt.crypt(pws[0], 'ab')
    dbpath = os.path.join(SEC_DB_PATH, user)
    thisdir = os.path.dirname(os.path.abspath(__file__))
    if os.path.exists(dbpath):
        subprocess.Popen("sudo rm -rf {}".format(dbpath), shell=True)

    if DISTRO == 'darwin':