mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix(pytest): Minor fixes
This commit is contained in:
parent
a00d45fb43
commit
f7e58f4de2
2 changed files with 15 additions and 3 deletions
10
tests/README.md
Normal file
10
tests/README.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# System tests
|
||||
|
||||
|
||||
## Pytest
|
||||
|
||||
The tests assume you have the "dragonfly" binary in `<root>/build-dbg` directory.
|
||||
You can override the location of the binary using `DRAGONFLY_HOME` environment var.
|
||||
|
||||
to run pytest, run:
|
||||
`pytest -xv pytest`
|
|
@ -5,11 +5,13 @@ import subprocess
|
|||
import time
|
||||
from threading import Thread
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def dragonfly_db():
|
||||
def df_server():
|
||||
""" Starts a single DragonflyDB process, runs only once. """
|
||||
dragonfly_path = os.environ.get("DRAGONFLY_HOME", '../../build-dbg/dragonfly')
|
||||
dragonfly_path = os.environ.get("DRAGONFLY_HOME", os.path.join(
|
||||
SCRIPT_DIR, '../../build-dbg/dragonfly'))
|
||||
print("Starting DragonflyDB [{}]".format(dragonfly_path))
|
||||
# TODO: parse arguments and pass them over
|
||||
p = subprocess.Popen([dragonfly_path])
|
||||
|
@ -32,7 +34,7 @@ def dragonfly_db():
|
|||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def connection(dragonfly_db):
|
||||
def connection(df_server):
|
||||
pool = redis.ConnectionPool(decode_responses=True)
|
||||
client = redis.Redis(connection_pool=pool)
|
||||
return client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue