File: test_settings.py

package info (click to toggle)
fs-uae-arcade 3.1.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 24,456 kB
  • sloc: python: 56,011; makefile: 170
file content (52 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (3)
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
import os
import tempfile
import fsbc.settings
import nose.tools


# def test_unload():
#     fd, path = tempfile.mkstemp()
#     os.close(fd)
#     fsbc.Settings.set_path(path)
#     fsbc.Settings.load()
#     os.unlink(path)
#
#     fsbc.Settings.set("Key-å", "Value-å")
#     fsbc.Settings.unload()
#
#     fsbc.Settings.set_path("")
#
#     value = fsbc.Settings.get("Key-å")
#     assert_equals(value, "")


def test_load_save():
    fd, path = tempfile.mkstemp()
    os.close(fd)
    fsbc.settings.set_path(path)
    fsbc.settings.load()

    fsbc.settings.set("Key-å", "Value-å")
    fsbc.settings.save()
    fsbc.settings.unload()

    fsbc.settings.load()

    value = fsbc.settings.get("key-å")
    nose.tools.assert_equals(value, "Value-å")
    fsbc.settings.unload()


def test_mypy():
    # from nose.plugins.skip import SkipTest
    # raise SkipTest()
    import fstd.mypy

    fstd.mypy.check_module(fsbc.settings.__name__)


def test_doctest():
    import doctest

    failure_count, test_count = doctest.testmod(fsbc.settings)
    nose.tools.assert_equals(failure_count, 0)