How to use morf_filename method in autotest

Best Python code snippet using autotest_python

coverage.py

Source:coverage.py Github

copy

Full Screen

...229 if not self.cexecuted.has_key(f):230 self.cexecuted[f] = {}231 self.cexecuted[f][lineno] = 1232 c = {}233 # morf_filename(morf). Return the filename for a module or file.234 def morf_filename(self, morf):235 if isinstance(morf, types.ModuleType):236 if not hasattr(morf, '__file__'):237 raise self.error, "Module has no __file__ attribute."238 file = morf.__file__239 else:240 file = morf241 return self.canonical_filename(file)242 # analyze_morf(morf). Analyze the module or filename passed as243 # the argument. If the source code can't be found, raise an error.244 # Otherwise, return a pair of (1) the canonical filename of the245 # source code for the module, and (2) a list of lines of statements246 # in the source code.247 def analyze_morf(self, morf):248 if self.analysis_cache.has_key(morf):249 return self.analysis_cache[morf]250 filename = self.morf_filename(morf)251 ext = os.path.splitext(filename)[1]252 if ext == '.pyc':253 if not os.path.exists(filename[0:-1]):254 raise self.error, ("No source for compiled code '%s'."255 % filename)256 filename = filename[0:-1]257 elif ext != '.py':258 raise self.error, "File '%s' not Python source." % filename259 source = open(filename, 'r')260 import parser261 tree = parser.suite(source.read()).totuple(1)262 source.close()263 statements = {}264 self.find_statements(tree, statements)...

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 autotest 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