How to use find_python method in prospector

Best Python code snippet using prospector_python

quickstart.py

Source: quickstart.py Github

copy

Full Screen

...11DEPLOY_DIR = os.path.join(ROOT_DIR, 'deploy')12VENV_DIR = os.path.abspath(os.path.join(DEPLOY_DIR, 'env'))13PYVER = "%d.%d" % (sys.version_info[0], sys.version_info[1])14MERCURIAL_WIN_BINARY = "http:/​/​mercurial.selenic.com/​release/​windows/​mercurial-2.5.2.win32-py%s.exe" % PYVER15def find_python():16 for bindir in ['Scripts', 'bin']:17 for suffix in ['.exe', '']:18 python_bin = os.path.join(VENV_DIR, bindir, 'python' + suffix)19 easy_install_bin = os.path.join(VENV_DIR, bindir, 'easy_install' + suffix)20 if os.path.exists(python_bin) and os.path.exists(easy_install_bin):21 return python_bin, easy_install_bin22 raise RuntimeError("Something went wrong in virtualenv creation: "23 "python and pip not found!")24def run_cmd(cmd):25 print("$ %s" % " ".join(cmd))26 ret = subprocess.call(cmd)27 if ret != 0:28 print("ERROR: command failed!")29 sys.exit(1)30def main():31 p = argparse.ArgumentParser(usage=__doc__.strip())32 args = p.parse_args()33 try:34 import virtualenv35 except ImportError:36 print("ERROR: You need to install Virtualenv (https:/​/​pypi.python.org/​pypi/​virtualenv) first")37 sys.exit(0)38 try:39 find_python()40 except RuntimeError:41 print("\n-- Creating virtualenv in deploy/​env")42 print("$ virtualenv %s" % VENV_DIR)43 virtualenv.create_environment(VENV_DIR)44 python_bin, easy_install_bin = find_python()45 os.chdir(ROOT_DIR)46 print("\n-- Installing required modules")47 with open('requirements.txt', 'r') as f:48 requirements = [x.strip() for x in f.read().splitlines() if x.strip()]49 if sys.platform.startswith('win'):50 # Download the windows binary51 requirements = [MERCURIAL_WIN_BINARY if x.lower().startswith('mercurial')52 else x for x in requirements]53 run_cmd([easy_install_bin] + requirements)54 print("\n-- Setting up development database")55 print("$ cd deploy")56 os.chdir(DEPLOY_DIR)57 run_cmd([python_bin, 'manage.py', 'syncdb'])58 run_cmd([python_bin, 'manage.py', 'migrate'])...

Full Screen

Full Screen

run.py

Source: run.py Github

copy

Full Screen

...5def run_tests(test_folder, runner):6 if not exists(test_folder):7 raise click.BadParameter('No such folder %s' % test_folder)8 if runner == 'unittest':9 shell(find_python() + ' -m unittest discover ' + str(test_folder), silent=False)10 elif runner == 'pytest':11 shell(find_python() + ' -m pip install --upgrade pytest')12 shell(find_python() + ' -m pytest ' + str(test_folder), silent=False)13 else:14 raise click.BadParameter('No such test runner: %s' % runner)15def run_coverage(source, test_dir, runner):16 if not exists(test_dir):17 raise click.BadParameter('No such folder or file: %s' % test_dir)18 if not exists(source):19 raise click.BadParameter('No such folder %s' % source)20 if runner == 'unittest':21 shell(find_python() + ' -m pip install --upgrade coverage')22 shell(find_python() + ' -m coverage run --source=%s -m unittest discover %s' %23 (source, test_dir), silent=False)24 elif runner == 'pytest':25 shell(find_python() + ' -m pip install --upgrade coverage pytest')26 shell(find_python() + ' -m coverage run --source=%s -m pytest %s' %27 (source, test_dir), silent=False)28 else:29 raise click.BadParameter('No such test runner: %s' % runner)30 shell(find_python() + ' -m coverage report -m', silent=False)31def run_docs():32 """Build the documentation and show it in the browser."""33 cwd = Path.cwd()34 if not exists(cwd /​ 'docs'):35 raise click.BadParameter('Cannot find docs folder.')36 shell('make clean', root=str(cwd /​ 'docs'), silent=False)37 shell(find_python() + ' -m sphinx.cmd.build -M html . _build', root=str(cwd /​ 'docs'), silent=False)38 click.launch(str(cwd /​ 'docs' /​ '_build' /​ 'html' /​ 'index.html'))39def run_flake8(dirs):40 """Run flake8 style enforcement in specified directories.41 Parameters42 ----------43 dirs: list of str44 The directories to scan for style violations.45 """46 shell(find_python() + ' -m pip install --upgrade flake8')...

Full Screen

Full Screen

test_model.py

Source: test_model.py Github

copy

Full Screen

1import os2from time import sleep3from model_part import find_log, find_model, read_txt4def find_python():5 python_path = os.getcwd()6 return python_path7def test_open():8 math_path = find_python()9 mode_list = find_log(math_path)10 find_model(math_path, mode_list)11def test_check():12 13 while True :14 read_txt(find_python())15 # print('這裡是訓練模型')16 sleep(2)17def model_main():18 test_check()19 ...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Test Optimization for Continuous Integration

“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Different Ways To Style CSS Box Shadow Effects

Have you ever visited a website that only has plain text and images? Most probably, no. It’s because such websites do not exist now. But there was a time when websites only had plain text and images with almost no styling. For the longest time, websites did not focus on user experience. For instance, this is how eBay’s homepage looked in 1999.

Fluent Interface Design Pattern in Automation Testing

Recently, I was going through some of the design patterns in Java by reading the book Head First Design Patterns by Eric Freeman, Elisabeth Robson, Bert Bates, and Kathy Sierra.

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