Русские видео

Сейчас в тренде

Иностранные видео




Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



How To: Pytest Fixtures In Python (2 Min)

In this tutorial, you'll learn how to use Pytest fixtures in Python. — Facebook:   / gokcedbsql   — Video Transcript: — Connect MySQL In Python:    • How To Connect To MySQL In Python (2 Min) ...   — Video Transcript: — Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to use PI test fixtures in Python. Let's start by looking at the test directory, I have a special conf test.py file and two test files that contain a total of three tests conf test.py file is a special PI test file that provides fixtures for the entire directory. Any fixtures defined here can be used by any test in this package without a need to import them. Fixtures are functions that are used to initialize test functions. You use the at PI test dot fixture decorator to define them. Here, I'm defining a read underscore config fixture which is reading the queries.text file. To use a fixture in your test function just pass them as the first argument. Here I'm passing the read underscore config fixture in both the test underscores first query and the test underscores second query test functions. In the test functions for the cash underscore sales report, I'm asserting whether the select keyword appears in both queries similarly for the customer report, I'm asserting whether the select keyword appears in the query output. To execute both the test files, right-click on the tests folder and hit run the PI test. As you can see all three tests passed. Let's see what happens if I change the select keyword in one of my tests to XYZ, my tests are failing as expected. To export the test results in the HTML format, hit the export test results button. There you have it. Make sure you like, subscribe, and turn on the notification bell. Until next time. conftest.py provides fixtures for the entire directory Fixtures defined here can be used by any test in that package without import them import pytest from configparser import ConfigParser import os fixtures are functions that are used to initialize test functions @pytest.fixture() def read_config(): parser = ConfigParser() root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) parser.read(root_dir + '/resources/queries.txt') return parser

Comments