def test_prepare_exec_for_file(test_apps):
 realpath = os.path.realpath('/tmp/share/test.py')
 dirname = os.path.dirname(realpath)
 assert (prepare_exec_for_file('/tmp/share/test.py') == 'test')
 assert (dirname in sys.path)
 realpath = os.path.realpath('/tmp/share/__init__.py')
 dirname = os.path.dirname(os.path.dirname(realpath))
 assert (prepare_exec_for_file('/tmp/share/__init__.py') == 'share')
 assert (dirname in sys.path)
 with pytest.raises(NoAppException):
  prepare_exec_for_file('/tmp/share/test.txt')

def test_prepare_exec_for_file ( test_apps ) : realpath = os . path . realpath ( '/tmp/share/test.py' ) dirname = os . path . dirname ( realpath ) assert ( prepare_exec_for_file ( '/tmp/share/test.py' ) == 'test' ) assert ( dirname in sys . path ) realpath = os . path . realpath ( '/tmp/share/__init__.py' ) dirname = os . path . dirname ( os . path . dirname ( realpath ) ) assert ( prepare_exec_for_file ( '/tmp/share/__init__.py' ) == 'share' ) assert ( dirname in sys . path ) with pytest . raises ( NoAppException ) : prepare_exec_for_file ( '/tmp/share/test.txt' )
expect the correct path to be set and the correct module name to be returned .