Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #56217 from aanderse/beanstalk

nixos/beanstalkd: update test to use python3 instead of python2

authored by

Florian Klink and committed by
GitHub
bea06ac6 ce019e77

+7 -5
+7 -5
nixos/tests/beanstalkd.nix
··· 1 1 import ./make-test.nix ({ pkgs, lib, ... }: 2 2 3 3 let 4 + pythonEnv = pkgs.python3.withPackages (p: [p.beanstalkc]); 5 + 4 6 produce = pkgs.writeScript "produce.py" '' 5 - #!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python 7 + #!${pythonEnv.interpreter} 6 8 import beanstalkc 7 9 8 10 queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False); 9 - queue.put('this is a job') 10 - queue.put('this is another job') 11 + queue.put(b'this is a job') 12 + queue.put(b'this is another job') 11 13 ''; 12 14 13 15 consume = pkgs.writeScript "consume.py" '' 14 - #!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python 16 + #!${pythonEnv.interpreter} 15 17 import beanstalkc 16 18 17 19 queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False); 18 20 19 21 job = queue.reserve(timeout=0) 20 - print job.body 22 + print(job.body.decode('utf-8')) 21 23 job.delete() 22 24 ''; 23 25