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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests. #5

Closed
wants to merge 1 commit into from
Closed

Fix tests. #5

wants to merge 1 commit into from

Conversation

dargor
Copy link
Contributor

@dargor dargor commented Aug 5, 2019

Tests are failing (reproduced on 1.0.0 and master) with :

========================================== FAILURES ===========================================
______________________________ test_delete_job_reserved_by_other ______________________________

    def wrapper() -> None:
        cmd = ('beanstalkd', '-l', '127.0.0.1', '-p', str(PORT))
        with subprocess.Popen(cmd) as beanstalkd:
            time.sleep(0.1)
            try:
                with Client(port=PORT, **kwargs) as c:
>                   test(c)

tests.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests.py:360: in test_delete_job_reserved_by_other
    c.delete(job)
greenstalk.py:253: in delete
    self._send_cmd(b'delete %d' % _to_id(job), b'DELETED')
greenstalk.py:172: in _send_cmd
    return _parse_response(line, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

line = b'NOT_FOUND', expected = b'DELETED'

    def _parse_response(line: bytes, expected: bytes) -> List[bytes]:
        if not line:
            raise ConnectionError("Unexpected EOF")
    
        assert line[-2:] == b'\r\n'
        line = line[:-2]
    
        status, *values = line.split()
    
        if status == expected:
            return values
    
        if status in ERROR_RESPONSES:
>           raise ERROR_RESPONSES[status](values)
E           greenstalk.NotFoundError: []

greenstalk.py:396: NotFoundError
============================ 1 failed, 35 passed in 11.09 seconds =============================

I guess the other job must be deleted by its owner, so here is a patch for it.

Signed-off-by: Gabriel Linder <linder.gabriel@gmail.com>
@codecov-io
Copy link

codecov-io commented Aug 5, 2019

Codecov Report

Merging #5 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #5   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines         181    181           
=====================================
  Hits          181    181

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3175fdb...d4f1c8f. Read the comment docs.

@justinmayhew
Copy link
Owner

Lets bump the sleep to 1.25 seconds and keep c.delete.

@dargor
Copy link
Contributor Author

dargor commented Aug 6, 2019

I still have transient failures with a sleep(1.25).

@justinmayhew
Copy link
Owner

I decided to remove the assertion in f94f2cb as it's mainly testing beanstalkd behavior anyways. Release 1.0.1 is on PyPI with this fix, thanks @dargor.

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

Successfully merging this pull request may close these issues.

None yet

3 participants