public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 12a4a5a2e4514e09ed8eab270497a1b4a243982a 1371 bytes (raw)

 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
 
#! /usr/bin/env avocado-runner-avocado-classless

"""
Self tests for avocado-classless plugins
"""

import types

from avocado_classless.manifest import manifest_add
from avocado_classless.test import (
    assert_eq, assert_eq_unordered, assert_in, assert_raises, test
)


@test
def trivial():
    pass


@test
def assert_true():
    assert True


# Check re-registering a function under a different name
manifest_add(__name__, "trivial2", trivial)


@test
def test_assert_eq():
    assert_eq(1, 1)


@test
def test_assert_in():
    assert_in(1, [1, 2, 3])
    assert_raises(AssertionError, assert_in, 'x', 'hello')


@test
def test_assert_raises():
    def boom(exc):
        raise exc
    assert_raises(ValueError, boom, ValueError)


@test
def test_assert_eq_unordered():
    assert_eq_unordered([1, 2, 3], (1, 2, 3))
    assert_eq_unordered([1, 2, 3], [2, 3, 1])
    assert_eq_unordered([1, 1, 1], (1, 1, 1))
    assert_raises(AssertionError, assert_eq_unordered, [1, 2, 3], [1, 2, 4])
    assert_raises(AssertionError, assert_eq_unordered, [1, 1], [1, 1, 1])


# Test we report attempting to double register the same test name
@test
def test_double_register():
    def double_register():
        mod = types.ModuleType('dummy')
        manifest_add(mod, "test", trivial)
        manifest_add(mod, "test", assert_true)
    assert_raises(ValueError, double_register)

debug log:

solving 12a4a5a2 ...
found 12a4a5a2 in https://archives.passt.top/passt-dev/20230627025429.2209702-8-david@gibson.dropbear.id.au/
found 26d02378 in https://archives.passt.top/passt-dev/20230627025429.2209702-7-david@gibson.dropbear.id.au/

applying [1/2] https://archives.passt.top/passt-dev/20230627025429.2209702-7-david@gibson.dropbear.id.au/
diff --git a/test/avocado_classless/selftests.py b/test/avocado_classless/selftests.py
new file mode 100644
index 00000000..26d02378


applying [2/2] https://archives.passt.top/passt-dev/20230627025429.2209702-8-david@gibson.dropbear.id.au/
diff --git a/test/avocado_classless/selftests.py b/test/avocado_classless/selftests.py
index 26d02378..12a4a5a2 100644

Checking patch test/avocado_classless/selftests.py...
Applied patch test/avocado_classless/selftests.py cleanly.
Checking patch test/avocado_classless/selftests.py...
Applied patch test/avocado_classless/selftests.py cleanly.

index at:
100644 12a4a5a2e4514e09ed8eab270497a1b4a243982a	test/avocado_classless/selftests.py

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).