Introduktion till testning i Python
Alexander Levin
Data Scientist
Integrationstestning – en testmetod som verifierar att en interaktion fungerar korrekt.
Integration – en interaktion mellan två eller fler moduler i ett system.

Exempel:
Möjliga integrationsproblem:
import pytest, os
@pytest.fixture
def setup_file():
# Create temporary file
file = "test_file.txt"
with open(file, "w") as f1:
f1.write("Test data 1")
yield file
os.remove(file)
def test_fs(setup_file):
file = setup_file
# Check that the file was created successfully
assert os.path.exists(file)
Integrationstestning – en testmetod som verifierar att en integration fungerar som förväntat.
Verkliga projekt innehåller många olika integrationer.
Integrationstestning hjälper till att förebygga många potentiella problem.
Exempel: kontrollera integrationen mellan Python och ett filsystem.
Introduktion till testning i Python