Merge pull request #56217 from aanderse/beanstalk

nixos/beanstalkd: update test to use python3 instead of python2
This commit is contained in:
Florian Klink 2019-02-23 18:51:46 +01:00 committed by GitHub
commit bea06ac613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,23 +1,25 @@
import ./make-test.nix ({ pkgs, lib, ... }:
let
pythonEnv = pkgs.python3.withPackages (p: [p.beanstalkc]);
produce = pkgs.writeScript "produce.py" ''
#!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python
#!${pythonEnv.interpreter}
import beanstalkc
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
queue.put('this is a job')
queue.put('this is another job')
queue.put(b'this is a job')
queue.put(b'this is another job')
'';
consume = pkgs.writeScript "consume.py" ''
#!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python
#!${pythonEnv.interpreter}
import beanstalkc
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
job = queue.reserve(timeout=0)
print job.body
print(job.body.decode('utf-8'))
job.delete()
'';