File: filesystem_test.py

package info (click to toggle)
pysdl2 0.9.9%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,276 kB
  • sloc: python: 18,592; makefile: 148; sh: 40
file content (29 lines) | stat: -rw-r--r-- 891 bytes parent folder | download
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
import os
import sys
import pytest
from ctypes import cast, c_char_p, addressof
from sdl2 import filesystem, SDL_free


class TestSDLFileSystem(object):
    __tags__ = ["sdl"]

    def test_SDL_GetBasePath(self):
        path = filesystem.SDL_GetBasePath()
        path = path.decode("utf-8")
        if sys.version_info[0] < 3:
            is_python_path = False
            for s in [u"python", u"pypy", u"pyenv", u"virtualenv"]:
                if s in path.lower():
                    is_python_path = True
                    break
            assert is_python_path
        else:
            execprefix = sys.base_exec_prefix
            assert execprefix.lower() in path.lower()

    def test_SDL_GetPrefPath(self):
        path = filesystem.SDL_GetPrefPath(b"OrgName", b"AppName")
        path = path.decode("utf-8")
        assert "OrgName" in path
        assert "AppName" in path