Debian Codegraph @

debian/tests/command-line

raw symbols SCIP
1 #!/bin/sh
2
3 # Superficial execution tests
4
5 testPrintFromStdin() {
6 stdout=$(echo 'print("Hello")' | pypy3)
7 assertEquals 'Execute code from stdin' Hello "$stdout"
8 }
9
10 testPrintFromMinusC() {
11 stdout=$(pypy3 -c 'print("Hello")')
12 assertEquals 'Execute code from -c' Hello "$stdout"
13 }
14
15 # Stdlib
16
17 testImportStdLib() {
18 pypy3 -c 'import os.path'
19 assertTrue 'Import os.path' $?
20 }
21
22 testImportTk() {
23 # Tkinter's cffi library lives in a separate binary package, to keep
24 # Depends manageable. Check that we point users to it.
25 if dpkg-query -f '${db:Status-Abbrev}\n' -W pypy3-tk | grep -q ^.i; then
26 # autopkgtest can't Conflict, so we just skip if it's present
27 startSkipping
28 fi
29 stderr=$(pypy3 -c 'import tkinter' 2>&1)
30 assertFalse 'Fail to import Tk when not installed' $?
31 echo "$stderr" | grep -Fq 'please install the pypy3-tk package'
32 assertTrue 'Suggest installing pypy3-tk' $?
33 }
34
35 testImportCFFI() {
36 # Are all the modules that use cffi importable?
37 # They're built separately, and often link to shared libs
38 pypy3 -c 'import audioop'
39 assertTrue 'Import audioop' $?
40 pypy3 -c 'import _blake2'
41 assertTrue 'Import _blake2' $?
42 pypy3 -c 'import curses'
43 assertTrue 'Import curses' $?
44 pypy3 -c 'import decimal'
45 assertTrue 'Import decimal' $?
46 pypy3 -c 'import _gdbm'
47 assertTrue 'Import _gdbm' $?
48 pypy3 -c 'import lzma'
49 assertTrue 'Import lzma' $?
50 pypy3 -c 'import pwd, grp'
51 assertTrue 'Import pwd, grp' $?
52 pypy3 -c 'import _sha3'
53 assertTrue 'Import _sha3' $?
54 pypy3 -c 'import ssl'
55 assertTrue 'Import ssl' $?
56 pypy3 -c 'import resource'
57 assertTrue 'Import resource' $?
58 pypy3 -c 'import sqlite3'
59 assertTrue 'Import sqlite3' $?
60 pypy3 -c 'import syslog'
61 assertTrue 'Import syslog' $?
62 }
63
64 . shunit2