Best Python code snippet using localstack_python
tasks.py
Source:tasks.py
1import os2import shlex3import sys4from invoke import task, util5in_ci = os.environ.get("CI", "false") == "true"6if in_ci:7 pty = False8else:9 pty = util.isatty(sys.stdout) and util.isatty(sys.stderr)10@task11def reformat(c):12 c.run("isort music_metadata_filter tests setup.py tasks.py", pty=pty)13 c.run("black music_metadata_filter tests setup.py tasks.py", pty=pty)14@task15def lint(c):16 c.run("flake8 --show-source --statistics music_metadata_filter tests", pty=pty)17@task18def test(c, onefile=""):19 pytest_args = ["pytest", "--cov=music_metadata_filter", "--cov-branch", "--cov-report=term"]20 if in_ci:21 pytest_args.extend(("--cov-report=xml", "--strict-markers"))22 else:23 pytest_args.append("--cov-report=html")24 if onefile:25 pytest_args.append(shlex.quote(onefile))26 c.run(" ".join(pytest_args), pty=pty)27@task28def type_check(c):...
test_upload_test_stats.py
Source:test_upload_test_stats.py
1import unittest2import os3IN_CI = os.environ.get("CI")4from tools.stats.upload_test_stats import get_tests5class TestUploadTestStats(unittest.TestCase):6 @unittest.skipIf(7 IN_CI,8 "don't run in CI as this does a lot of network calls and uses up GH API rate limit",9 )10 def test_existing_job(self) -> None:11 """Run on a known-good job and make sure we don't error and get basically okay reults."""12 test_cases, test_suites = get_tests(2465214458, 1)13 self.assertEqual(len(test_cases), 731457)14 self.assertEqual(len(test_suites), 7781)15if __name__ == "__main__":...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!