def project_root(parser, projdir=os.getcwd()):
 previousdir = curdir = osp.abspath(projdir)
 testercls = PyTester
 conf_file_path = osp.join(curdir, CONF_FILE)
 if osp.isfile(conf_file_path):
  testercls = load_pytest_conf(conf_file_path, parser)
 while (this_is_a_testdir(curdir) or osp.isfile(osp.join(curdir, '__init__.py'))):
  newdir = osp.normpath(osp.join(curdir, os.pardir))
  if (newdir == curdir):
   break
  previousdir = curdir
  curdir = newdir
  conf_file_path = osp.join(curdir, CONF_FILE)
  if osp.isfile(conf_file_path):
   testercls = load_pytest_conf(conf_file_path, parser)
 return (previousdir, testercls)

def project_root ( parser , projdir = os . getcwd ( ) ) : previousdir = curdir = osp . abspath ( projdir ) testercls = PyTester conf_file_path = osp . join ( curdir , CONF_FILE ) if osp . isfile ( conf_file_path ) : testercls = load_pytest_conf ( conf_file_path , parser ) while ( this_is_a_testdir ( curdir ) or osp . isfile ( osp . join ( curdir , '__init__.py' ) ) ) : newdir = osp . normpath ( osp . join ( curdir , os . pardir ) ) if ( newdir == curdir ) : break previousdir = curdir curdir = newdir conf_file_path = osp . join ( curdir , CONF_FILE ) if osp . isfile ( conf_file_path ) : testercls = load_pytest_conf ( conf_file_path , parser ) return ( previousdir , testercls )
try to find projects root and add it to sys .