Python में Testing का परिचय
Alexander Levin
Data Scientist
Performance - सॉफ्टवेयर किसी कार्य को करने के लिए सिस्टम के संसाधनों का कितना कुशल उपयोग करता है.
Performance Testing - सॉफ्टवेयर की परफॉर्मेंस को मापने वाली टेस्टिंग.
Resources:
उपयोग के मामले:
इंस्टॉलेशन:
pip install pytest-benchmark
# Example_1.py
import time
def test_func(benchmark):
benchmark(time.sleep, 1)
CLI कमांड:
pytest Example_1.py
CLI कमांड चलाने के बाद जो परिणाम मिलते हैं:

time.sleep(1) की जगह time.sleep(3) होने पर:

# Example_2.py
import time
def test_func(benchmark):
@benchmark
def sleep_for_1_sec():
time.sleep(1)
CLI कमांड:
pytest Example_2.py
pytest-benchmark फ़िक्स्चर का उपयोग कर सकते हैं:benchmark को सीधे कॉल करके@benchmark को डेकोरेटर की तरह लगाकरPython में Testing का परिचय