File: no-yaml.mkd

package info (click to toggle)
beanstalkc 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 128 kB
  • sloc: python: 246; makefile: 12
file content (50 lines) | stat: -rw-r--r-- 1,357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Regression tests for YAMLless operation
=======================================

Job priorities are not preserved
--------------------------------

Setup a connection that won't parse YAML:

    >>> import beanstalkc
    >>> beanstalk = beanstalkc.Connection(host='localhost', port=14711,
    ...                                   parse_yaml=False)

Observe that YAML is not parsed:

    >>> isinstance(beanstalk.stats(), str)
    True

Note that while Job#release and Job#bury will still work, they won't
automatically maintain the released/buried Job's priority:

    >>> jid = beanstalk.put('foo', priority=42)

    >>> job = beanstalk.reserve()
    >>> print repr(job.stats())                     # doctest: +ELLIPSIS
    '...pri: 42...'

    >>> job.release()               # Succeeds, but ...

    >>> job = beanstalk.reserve()   # ... may not do what you want.
    >>> print repr(job.stats())                     # doctest: +ELLIPSIS
    '...pri: 2147483648...'

    >>> job.delete()

Same for Job#bury:

    >>> jid = beanstalk.put('bar', priority=42)

    >>> job = beanstalk.reserve()
    >>> print repr(job.stats())                     # doctest: +ELLIPSIS
    '...pri: 42...'

    >>> job.bury()

    >>> print repr(beanstalk.stats_job(jid))        # doctest: +ELLIPSIS
    '...pri: 2147483648...'

And that was that.

    >>> beanstalk.close()