Skip to content

Commit

Permalink
Merge pull request #141 from zopefoundation/use-temp-dir-please
Browse files Browse the repository at this point in the history
Use a temporary directory in tests
  • Loading branch information
mgedmin authored Apr 25, 2019
2 parents bd7cd06 + 9266c3d commit a6c1ffc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/ZEO/tests/test_client_side_conflict_resolution.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import os
import shutil
import tempfile
import unittest
import zope.testing.setupstack

import zope.testing.setupstack
from BTrees.Length import Length
from ZODB import serialize
from ZODB.DemoStorage import DemoStorage
from ZODB.utils import p64, z64, maxtid
from ZODB.utils import z64, maxtid
from ZODB.broken import find_global

import ZEO
Expand Down Expand Up @@ -111,7 +114,9 @@ def test_server_side(self):

def test_client_side(self):
# First, traditional:
addr, stop = ZEO.server('data.fs', threaded=False)
path = tempfile.mkdtemp(prefix='zeo-test-')
self.addCleanup(shutil.rmtree, path)
addr, stop = ZEO.server(os.path.join(path, 'data.fs'), threaded=False)
db = ZEO.DB(addr)
with db.transaction() as conn:
conn.root.l = Length(0)
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ envlist =
[testenv]
commands =
# Run unit tests first.
zope-testrunner -u --test-path=src --auto-color --auto-progress
zope-testrunner -u --test-path=src --auto-color --auto-progress {posargs}
# Only run functional tests if unit tests pass.
zope-testrunner -f --test-path=src --auto-color --auto-progress
zope-testrunner -f --test-path=src --auto-color --auto-progress {posargs}
deps =
ZODB >= 4.2.0b1
random2
Expand Down

0 comments on commit a6c1ffc

Please sign in to comment.