Skip to content

Commit 9aeec4c

Browse files
committed
Make profiling optional
1 parent 8b1469d commit 9aeec4c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tasks.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,39 @@ def all_tests(c):
4242

4343

4444
@task
45-
def tests(c, uvloop=False, protocol=2):
46-
"""Run the redis-py test suite against the current python,
47-
with and without hiredis.
48-
"""
45+
def tests(c, uvloop=False, protocol=2, profile=False):
46+
"""Run the redis-py test suite against the current python."""
4947
print("Starting Redis tests")
50-
standalone_tests(c, uvloop=uvloop, protocol=protocol)
51-
cluster_tests(c, uvloop=uvloop, protocol=protocol)
48+
standalone_tests(c, uvloop=uvloop, protocol=protocol, profile=profile)
49+
cluster_tests(c, uvloop=uvloop, protocol=protocol, profile=profile)
5250

5351

5452
@task
55-
def standalone_tests(c, uvloop=False, protocol=2):
53+
def standalone_tests(c, uvloop=False, protocol=2, profile=False):
5654
"""Run tests against a standalone redis instance"""
55+
profile_arg = "--profile" if profile else ""
5756
if uvloop:
5857
run(
59-
f"pytest --profile --profile-svg --line-profile --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' --uvloop --junit-xml=standalone-uvloop-results.xml"
58+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' --uvloop --junit-xml=standalone-uvloop-results.xml"
6059
)
6160
else:
6261
run(
63-
f"pytest --profile --profile-svg --line-profile --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' --junit-xml=standalone-results.xml"
62+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' --junit-xml=standalone-results.xml"
6463
)
6564

6665

6766
@task
68-
def cluster_tests(c, uvloop=False, protocol=2):
67+
def cluster_tests(c, uvloop=False, protocol=2, profile=False):
6968
"""Run tests against a redis cluster"""
69+
profile_arg = "--profile" if profile else ""
7070
cluster_url = "redis://localhost:16379/0"
7171
if uvloop:
7272
run(
73-
f"pytest --profile --profile-svg --line-profile --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=cluster-uvloop-results.xml --uvloop"
73+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=cluster-uvloop-results.xml --uvloop"
7474
)
7575
else:
7676
run(
77-
f"pytest --profile --profile-svg --line-profile --protocol={protocol} --cov=./ --cov-report=xml:coverage_clusteclient.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=cluster-results.xml"
77+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_clusteclient.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --junit-xml=cluster-results.xml"
7878
)
7979

8080

0 commit comments

Comments
 (0)