Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pylibmc an optional dependency, available as an extra. #17

Merged
merged 2 commits into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ Service fixtures
* memcached_connection
Memcached connection string.
* do_memcached_clean
Determine if memcached should be cleared before every test run. Equals to `run_services` fixture by default.
Determine if memcached should be cleared before every test run. Equals to `run_services` fixture by default. Requires `pylibmc` installed or `memcache` indicated
as an extra.
* memcached_client
A pylibmc.Client instance bound to the service. Requires `pylibmc` installed
or `memcache` indicated as an extra.
* mysql
Start mysql-server_ instance.
* mysql_database_name
Expand Down
5 changes: 2 additions & 3 deletions pytest_services/memcached.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import os
import pytest

from pylibmc import Client


@pytest.fixture(scope='session')
def memcached_socket(run_dir, run_services):
Expand Down Expand Up @@ -38,7 +36,8 @@ def do_memcached_clean(run_services):
@pytest.fixture(scope='session')
def memcached_client(memcached_socket, memcached):
"""Create client for memcached."""
return Client([memcached_socket])
mc = pytest.importorskip('pylibmc')
return mc.Client([memcached_socket])


@pytest.fixture
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'setuptools',
'requests',
'psutil',
'pylibmc',
'pytest',
]

Expand All @@ -38,6 +37,9 @@
version=pytest_services.__version__,
url='https://github.com/pytest-dev/pytest-services',
install_requires=install_requires,
extras={
'memcached': ['pylibmc'],
},
classifiers=[
'Development Status :: 6 - Mature',
'Intended Audience :: Developers',
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ deps =
-e.
-r{toxinidir}/requirements-testing.txt
passenv = DISPLAY COVERALLS_REPO_TOKEN USER TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
extras = memcache

[testenv:linters]
basepython=python2.7
Expand Down