mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
Testing/click (#99)
* annotate context * remove whitespace * test CLI * make format * github action with submodule checkout * maybe now * vllt ja nu * und no? * back to normal mint running * githuuuuub * COME OOOON! * SO. CLOSE. * make format * new test * fix it * make format * receive v1 token test
This commit is contained in:
42
tests/conftest.py
Normal file
42
tests/conftest.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import multiprocessing
|
||||
import time
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import uvicorn
|
||||
from uvicorn import Config, Server
|
||||
|
||||
from cashu.core.migrations import migrate_databases
|
||||
from cashu.wallet import migrations
|
||||
from cashu.wallet.wallet import Wallet
|
||||
|
||||
SERVER_ENDPOINT = "http://localhost:3337"
|
||||
|
||||
|
||||
class UvicornServer(multiprocessing.Process):
|
||||
def __init__(self, config: Config):
|
||||
super().__init__()
|
||||
self.server = Server(config=config)
|
||||
self.config = config
|
||||
|
||||
def stop(self):
|
||||
self.terminate()
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
self.server.run()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="session")
|
||||
def mint():
|
||||
|
||||
config = uvicorn.Config(
|
||||
"cashu.mint.app:app",
|
||||
port=3337,
|
||||
host="127.0.0.1",
|
||||
)
|
||||
|
||||
server = UvicornServer(config=config)
|
||||
server.start()
|
||||
time.sleep(1)
|
||||
yield server
|
||||
server.stop()
|
||||
Reference in New Issue
Block a user