How to use list_mount_points method in avocado

Best Python code snippet using avocado_python

mount.py

Source:mount.py Github

copy

Full Screen

2Utilities for working with unix-style mounts.3"""4import os5import subprocess6def list_mount_points():7 """8 Return list of current mount points9 Note: unix-like OS specific10 """11 mount_points = []12 likely_locations = ['/sbin/mount', '/bin/mount']13 for mount in likely_locations:14 if os.path.exists(mount):15 p = subprocess.Popen(mount, stdout=subprocess.PIPE)16 p.wait()17 for l in p.stdout.readlines():18 rec = l.split()19 device = rec[0] 20 mount_point = rec[2]21 assert rec[1] == 'on'22 # looking at the output of mount on linux, osx, and 23 # sunos, the first 3 elements are always the same24 # devicename on path25 # everything after that displays the attributes26 # of the mount points in wildly differing formats27 mount_points.append(mount_point)28 return mount_points29 else:30 raise RuntimeError("Couldn't find a mount executable")31def is_mounted(point_to_check):32 """33 Return true if argument exactly matches a current mount point.34 """35 for mount_point in list_mount_points():36 if point_to_check == mount_point:37 return True38 else:39 return False40def find_mount_point_for(pathname):41 """42 Find the deepest mount point pathname is located on43 """44 realpath = os.path.realpath(pathname)45 mount_points = list_mount_points()46 prefixes = set()47 for current_mount in mount_points:48 cp = os.path.commonprefix([current_mount, realpath])49 prefixes.add((len(cp), cp))50 prefixes = list(prefixes)51 prefixes.sort()52 if len(prefixes) == 0:53 return None54 else:55 # return longest common prefix...

Full Screen

Full Screen

cmds.py

Source:cmds.py Github

copy

Full Screen

1# Copyright (C) 2007-2011 Andrea Francia Trivolzio(PV) Italy2import sys,os3def restore():4 from trashcli.restore import RestoreCmd5 try: # Python 26 input23 = raw_input7 except: # Python 38 input23 = input9 RestoreCmd(10 stdout = sys.stdout,11 stderr = sys.stderr,12 environ = os.environ,13 exit = sys.exit,14 input = input2315 ).run(sys.argv)16def empty(argv = sys.argv,17 stdout = sys.stdout,18 stderr = sys.stderr,19 environ = os.environ):20 from trashcli.empty import EmptyCmd21 from trashcli.list_mount_points import mount_points22 from datetime import datetime23 from trashcli.trash import FileSystemReader24 from trashcli.fs import FileRemover25 from trashcli.trash import version26 return EmptyCmd(27 out = stdout,28 err = stderr,29 environ = environ,30 list_volumes = mount_points,31 now = datetime.now,32 file_reader = FileSystemReader(),33 getuid = os.getuid,34 file_remover = FileRemover(),35 version = version,36 ).run(*argv)37def list():38 from trashcli.list import ListCmd39 from trashcli.list_mount_points import mount_points40 ListCmd(41 out = sys.stdout,42 err = sys.stderr,43 environ = os.environ,44 getuid = os.getuid,45 list_volumes = mount_points,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful