Skip to content

Commit

Permalink
Merge pull request #23 from fizyk/tmpdir
Browse files Browse the repository at this point in the history
default logsdir to $TMPDIR
  • Loading branch information
fizyk committed Aug 25, 2016
2 parents ab720a4 + 54626a2 commit ab9c579
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
unreleased
-------

- [feature] - default logsdir to $TMPDIR
- [feature] - run process on random port by default - enhances xdist experience

1.1.0
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ You can pick which you prefer, but remember that these settings are handled in t
+----------------------+--------------------------------------+------------------------------------------------------+----------------------------------------------------+------------------------------+
| Elasticsearch option | Fixture factory argument | Command line option | pytest.ini option | Default |
+======================+======================================+======================================================+====================================================+==============================+
| logs directory | logsdir | --elasticsearch-logsdir | elasticsearch_logsdir | /tmp |
| logs directory | logsdir | --elasticsearch-logsdir | elasticsearch_logsdir | $TMPDIR |
+----------------------+--------------------------------------+------------------------------------------------------+----------------------------------------------------+------------------------------+
| host | host | --elasticsearch-host | elasticsearch_host | 127.0.0.1 |
+----------------------+--------------------------------------+------------------------------------------------------+----------------------------------------------------+------------------------------+
Expand Down
4 changes: 3 additions & 1 deletion src/pytest_elasticsearch/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with pytest-elasticsearch. If not, see <http://www.gnu.org/licenses/>.
"""Pytest-elasticsearch py.test's plugin configuration."""
from tempfile import gettempdir

import pytest # noqa

from pytest_elasticsearch import factories
Expand All @@ -38,7 +40,7 @@ def pytest_addoption(parser):
parser.addini(
name='elasticsearch_logsdir',
help=_help_logsdir,
default='/tmp'
default=gettempdir()
)

parser.addini(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_elastic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Pytest-elasticsearch tests."""
from tempfile import gettempdir

from mock import patch

from pytest_elasticsearch import factories
Expand Down Expand Up @@ -28,7 +30,7 @@ def test_default_configuration(request):
"""Test default configuration."""
config = factories.return_config(request)

assert config['logsdir'] == '/tmp'
assert config['logsdir'] == gettempdir()
assert not config['port']
assert config['host'] == '127.0.0.1'
assert not config['cluster_name']
Expand Down

0 comments on commit ab9c579

Please sign in to comment.