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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

LimitedSet does not perform as expected - tests fail #3879

Closed
caronc opened this issue Mar 2, 2017 · 0 comments
Closed

LimitedSet does not perform as expected - tests fail #3879

caronc opened this issue Mar 2, 2017 · 0 comments

Comments

@caronc
Copy link
Contributor

caronc commented Mar 2, 2017

Checklist

  • Celery Version v3.1.25
  • [ X] I have verified that the issue exists against the master branch of Celery.

Steps to reproduce

Run unit tests

Expected behavior

That they'd pass 馃槈

Actual behavior

Why they all pass except the ones related to LimitedSet

The results appear to be the absolute invert of what is expected; have a look; here is the output:

__________________________________________________ test_LimitedSet.test_add ___________________________________________________

self = <celery.tests.utils.test_datastructures.test_LimitedSet testMethod=test_add>

    def test_add(self):
        if sys.platform == 'win32':
            raise SkipTest('Not working properly on Windows')
        s = LimitedSet(maxlen=2)
        s.add('foo')
        s.add('bar')
        for n in 'foo', 'bar':
            self.assertIn(n, s)
        s.add('baz')
        for n in 'bar', 'baz':
>           self.assertIn(n, s)
E           AssertionError: 'bar' not found in LimitedSet(2)

celery/tests/utils/test_datastructures.py:185: AssertionError
__________________________________________________ test_LimitedSet.test_iter __________________________________________________

self = <celery.tests.utils.test_datastructures.test_LimitedSet testMethod=test_iter>

    def test_iter(self):
        if sys.platform == 'win32':
            raise SkipTest('Not working on Windows')
        s = LimitedSet(maxlen=3)
        items = ['foo', 'bar', 'baz', 'xaz']
        for item in items:
            s.add(item)
        l = list(iter(s))
        for item in items[1:]:
>           self.assertIn(item, l)
E           AssertionError: 'bar' not found in ['baz', 'foo', 'xaz']

celery/tests/utils/test_datastructures.py:242: AssertionError
_________________________________________________ test_LimitedSet.test_update _________________________________________________

self = <celery.tests.utils.test_datastructures.test_LimitedSet testMethod=test_update>

    def test_update(self):
        s1 = LimitedSet(maxlen=2)
        s1.add('foo')
        s1.add('bar')
    
        s2 = LimitedSet(maxlen=2)
        s2.update(s1)
        self.assertItemsEqual(list(s2), ['foo', 'bar'])
    
        s2.update(['bla'])
>       self.assertItemsEqual(list(s2), ['bla', 'bar'])

celery/tests/utils/test_datastructures.py:280: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
celery/tests/case.py:367: in assertItemsEqual
    return self.assertSequenceEqual(expected, actual, msg=msg)
E   AssertionError: Sequences differ: ['bla', 'foo'] != ['bar', 'bla']
E   
E   First differing element 0:
E   bla
E   bar
E   
E   - ['bla', 'foo']
E   + ['bar', 'bla']

Just to give you more details on my environment (in case it's related):

  • I'm using CentOS 7.x putting my on Python 2.7.5
  • billiard v3.3.0.20
  • kombu v3.0.37
  • pyparsing v1.5.6
  • pytest v3.0.6
  • dateutil v2.2-1
  • anyjson v0.3.3
  • amqp v2.1.4
  • pytz v2016.10
  • uuid v1.30
thedrow pushed a commit that referenced this issue Oct 8, 2017
* LimitedSets support on faster systems refs #3879 and #3891

* corrected reference (ported from #3879)

* handle update() calls where time is specified

* added monotonic() replacement to time() in LimitSets; refs #3891

* using monotonic() from celery.vine; refs #3891

* oops forgot to remove some old references to code; sorry

* references to time in LimitSet tests updated

* removed unnessisary inline comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant