26 lines
No EOL
694 B
Python
26 lines
No EOL
694 B
Python
import pytest
|
|
import shutil
|
|
from pathlib import Path
|
|
from app import create_app
|
|
|
|
@pytest.fixture()
|
|
def app():
|
|
app = create_app()
|
|
# Copy the sample to the test folder using python
|
|
shutil.copy(Path(__file__).parent.parent / 'sample' / 'athletes.json', Path(__file__).parent / 'tests' / 'athletes.json')
|
|
app.config.update({
|
|
"TESTING": True,
|
|
"ATHLETE_FILE": Path(__file__).parent / 'tests' / 'athletes.json'
|
|
})
|
|
yield app
|
|
|
|
# Remove the file after the test
|
|
(Path(__file__).parent / 'tests' / 'athletes.json').unlink()
|
|
|
|
@pytest.fixture()
|
|
def client(app):
|
|
return app.test_client()
|
|
|
|
@pytest.fixture()
|
|
def runner(app):
|
|
return app.test_cli_runner() |