Commit 9266c3db authored by Marius Gedminas's avatar Marius Gedminas

Use a temporary directory in tests

Otherwise when you run `tox` this test will create a `data.fs` using
Python 2 and then the same test will fail on Python 3 because there
already is a `data.fs` in the current working directory, but it has an
incompatible format.
parent bd7cd066
import os
import shutil
import tempfile
import unittest import unittest
import zope.testing.setupstack
import zope.testing.setupstack
from BTrees.Length import Length from BTrees.Length import Length
from ZODB import serialize from ZODB import serialize
from ZODB.DemoStorage import DemoStorage from ZODB.DemoStorage import DemoStorage
from ZODB.utils import p64, z64, maxtid from ZODB.utils import z64, maxtid
from ZODB.broken import find_global from ZODB.broken import find_global
import ZEO import ZEO
...@@ -111,7 +114,9 @@ class ClientSideConflictResolutionTests(zope.testing.setupstack.TestCase): ...@@ -111,7 +114,9 @@ class ClientSideConflictResolutionTests(zope.testing.setupstack.TestCase):
def test_client_side(self): def test_client_side(self):
# First, traditional: # 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) db = ZEO.DB(addr)
with db.transaction() as conn: with db.transaction() as conn:
conn.root.l = Length(0) conn.root.l = Length(0)
......
...@@ -5,9 +5,9 @@ envlist = ...@@ -5,9 +5,9 @@ envlist =
[testenv] [testenv]
commands = commands =
# Run unit tests first. # 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. # 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 = deps =
ZODB >= 4.2.0b1 ZODB >= 4.2.0b1
random2 random2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment