Skip to content

Commit

Permalink
Merge pull request twisted#9 from psi29a/travisandtrialfixes
Browse files Browse the repository at this point in the history
travis update plus bare min changes to get trial/nosetests working
  • Loading branch information
glyph committed Jul 10, 2014
2 parents 7562df5 + c1fe092 commit 4d46e95
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
/doc/addressbook-ldif
/doc/*.dia.png
/ldaptor/test/ldif/webtests.tmp
ldaptor.test.test_config
ldaptor.test.*
ldaptor.egg-info
.idea
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: python
python: 2.7

env:
matrix:
- TOX_ENV=pyflakes
- TOX_ENV=py26
- TOX_ENV=py27
Expand Down Expand Up @@ -31,6 +32,29 @@ env:
- TOX_ENV=py27-tw121
- TOX_ENV=pypy-tw121

matrix:
fast_finish: true
allow_failures:
- env: TOX_ENV=pyflakes
- env: TOX_ENV=py26
- env: TOX_ENV=py27
- env: TOX_ENV=py26-twtrunk
- env: TOX_ENV=py27-twtrunk
- env: TOX_ENV=py26-tw140
- env: TOX_ENV=py27-tw140
- env: TOX_ENV=py26-tw132
- env: TOX_ENV=py27-tw132
- env: TOX_ENV=py26-tw131
- env: TOX_ENV=py27-tw131
- env: TOX_ENV=py26-tw130
- env: TOX_ENV=py27-tw130
- env: TOX_ENV=py26-tw123
- env: TOX_ENV=py27-tw123
- env: TOX_ENV=py26-tw122
- env: TOX_ENV=py27-tw122
- env: TOX_ENV=py26-tw121
- env: TOX_ENV=py27-tw121

script: pip install tox && tox -e $TOX_ENV

notifications:
Expand Down
51 changes: 31 additions & 20 deletions ldaptor/test/test_ldiftree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,40 @@
Test cases for LDIF directory tree writing/reading.
"""

import os
import random
import errno
import shutil

from twisted.trial import unittest
import os, random, errno, shutil, sets

from ldaptor import ldiftree, entry, delta, testutil
from ldaptor.entry import BaseLDAPEntry
from ldaptor.protocols.ldap import ldaperrors, ldifprotocol


def writeFile(path, content):
f = file(path, 'w')
f.write(content)
f.close()


class RandomizeListdirMixin(object):
def randomListdir(self, *args, **kwargs):
r = self.__listdir(*args, **kwargs)
@classmethod
def randomListdir(cls, *args, **kwargs):
r = cls.__listdir(*args, **kwargs)
random.shuffle(r)
return r

def setUpClass(self):
self.__listdir = os.listdir
os.listdir = self.randomListdir
@classmethod
def setUpClass(cls):
cls.__listdir = os.listdir
os.listdir = cls.randomListdir

@classmethod
def tearDownClass(cls):
os.listdir = cls.__listdir

def tearDownClass(self):
os.listdir = self.__listdir

class Dir2LDIF(RandomizeListdirMixin, unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -767,8 +778,8 @@ def test_move_noChildren_sameSuperior(self):
def getChildren(dummy):
return self.example.children()
d.addCallback(getChildren)
d.addCallback(sets.Set)
d.addCallback(self.assertEquals, sets.Set([
d.addCallback(set)
d.addCallback(self.assertEquals, set([
self.meta,
BaseLDAPEntry(
dn='ou=moved,dc=example,dc=com',
Expand All @@ -784,8 +795,8 @@ def test_move_children_sameSuperior(self):
def getChildren(dummy):
return self.example.children()
d.addCallback(getChildren)
d.addCallback(sets.Set)
d.addCallback(self.assertEquals, sets.Set([
d.addCallback(set)
d.addCallback(self.assertEquals, set([
BaseLDAPEntry(dn='ou=moved,dc=example,dc=com',
attributes={ 'objectClass': ['a', 'b'],
'ou': ['moved'],
Expand All @@ -801,16 +812,16 @@ def test_move_noChildren_newSuperior(self):
def getChildren(dummy):
return self.example.children()
d.addCallback(getChildren)
d.addCallback(sets.Set)
d.addCallback(self.assertEquals, sets.Set([
d.addCallback(set)
d.addCallback(self.assertEquals, set([
self.meta,
self.oneChild,
]))
def getChildren2(dummy):
return self.oneChild.children()
d.addCallback(getChildren2)
d.addCallback(sets.Set)
d.addCallback(self.assertEquals, sets.Set([
d.addCallback(set)
d.addCallback(self.assertEquals, set([
self.theChild,
BaseLDAPEntry(
dn='ou=moved,ou=oneChild,dc=example,dc=com',
Expand All @@ -825,16 +836,16 @@ def test_move_children_newSuperior(self):
def getChildren(dummy):
return self.example.children()
d.addCallback(getChildren)
d.addCallback(sets.Set)
d.addCallback(self.assertEquals, sets.Set([
d.addCallback(set)
d.addCallback(self.assertEquals, set([
self.empty,
self.oneChild,
]))
def getChildren2(dummy):
return self.oneChild.children()
d.addCallback(getChildren2)
d.addCallback(sets.Set)
d.addCallback(self.assertEquals, sets.Set([
d.addCallback(set)
d.addCallback(self.assertEquals, set([
self.theChild,
BaseLDAPEntry(dn='ou=moved,ou=oneChild,dc=example,dc=com',
attributes={ 'objectClass': ['a', 'b'],
Expand Down

0 comments on commit 4d46e95

Please sign in to comment.