File: python_test.sh

package info (click to toggle)
autodep8 0.30
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 276 kB
  • sloc: sh: 1,139; makefile: 31
file content (115 lines) | stat: -rw-r--r-- 4,536 bytes parent folder | download | duplicates (4)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
. $(dirname $0)/helper.sh

test_python_detect_source_python() {
  has 'debian/control' 'Source: python-foo\n\nPackage:python-foo'
  check_run autodep8
  assertFalse 'creates no test for python2' 'test -s stdout'
}

test_python_detect_source_py3() {
  has 'debian/control' 'Source: python-foo\n\nPackage:python3-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
}

test_python_unusual_name_py3() {
  has 'debian/control' 'Source: python-foo\n\nPackage:python3-foo'
  has 'debian/tests/pkg-python/import-name' '# no capital letters in package names\nFoo\n'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import Foo;" stdout'
  assertFalse 'not using wrong name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
  assertTrue 'grep "W:.*deprecated" stderr'
}

test_python_unusual_name_py3_via_config() {
  has 'debian/control' 'Source: python-foo\n\nPackage:python3-foo'
  has 'debian/tests/autopkgtest-pkg-python.conf' 'import_name = Foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import Foo;" stdout'
  assertFalse 'not using wrong name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
}

test_python_underscore_py3() {
  has 'debian/control' 'Source: python-foo-bar\n\nPackage:python3-foo-bar'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo_bar;" stdout'
  assertFalse 'not using wrong name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
}

# PyPy is only Python 2 compatible for now.
test_python_detect_source_pypy() {
  has 'debian/control' 'Source: python-foo\n\nPackage:pypy-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have pypy test' 'grep --quiet "pypy -c" stdout'
  assertFalse 'dont have py3 test' 'grep --quiet "py3versions" stdout'
}

test_python_detect_binary_py3() {
  has 'debian/control' 'Source: foo\n\nPackage: python3-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
}

test_python_detect_binary_pypy() {
  has 'debian/control' 'Source: foo\n\nPackage: pypy-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertFalse 'dont have py3 test' 'grep --quiet "py3versions" stdout'
  assertTrue 'have pypy test' 'grep --quiet "pypy -c" stdout'
}

test_python_detect_binary_all() {
  has 'debian/control' 'Source: foo\n\nPackage: python-foo\n\nPackage: python3-foo\n\nPackage: pypy-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
  assertTrue 'have pypy test' 'grep --quiet "pypy -c" stdout'
}

test_python_ignore_doc_py3() {
  has 'debian/control' 'Source: foo\n\nPackage: python3-foo-doc\n\nPackage: python3-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
}

test_python_ignore_doc_pypy() {
  has 'debian/control' 'Source: foo\n\nPackage: pypy-foo-doc\n\nPackage: pypy-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertFalse 'dont have py3 test' 'grep --quiet "py3versions" stdout'
  assertTrue 'have pypy test' 'grep --quiet "pypy -c" stdout'
}

test_python_ignore_common_package() {
  has 'debian/control' 'Source: python-foo\n\nPackage: python-foo-common\n\nPackage: python3-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
}

test_Testsuite_autopkgtest_pkg_python() {
  has debian/control "Testsuite: autopkgtest-pkg-python"
  check_run autodep8
}

test_XS_Testsuite_autopkgtest_pkg_python() {
  has debian/control 'XS-Testsuite: autopkgtest-pkg-python'
  check_run autodep8
}

test_python3_dev_only_d() {
  has 'debian/control' 'Source: python-foo\nBuild-Depends: python3-dev\n\nPackage:python3-foo'
  check_run autodep8
  assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
  assertTrue 'test current python3' 'grep --quiet "py3versions -d" stdout'
  assertFalse 'dont test other python3' 'grep --quiet "pyversions -r" stdout'
}

. shunit2