How to use protontricks - 10 common examples

To help you get started, we’ve selected a few protontricks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Matoking / protontricks / tests / test_steam.py View on Github external
def test_steam_app_from_appmanifest_empty(self, steam_app_factory):
        steam_app = steam_app_factory(name="Fake game", appid=10)

        appmanifest_path = \
            Path(steam_app.install_path).parent.parent / "appmanifest_10.acf"
        appmanifest_path.write_text("")

        # Empty appmanifest file is ignored
        assert not SteamApp.from_appmanifest(
            path=str(appmanifest_path),
            steam_lib_paths=[]
        )
github Matoking / protontricks / tests / test_steam.py View on Github external
def test_steam_app_from_appmanifest_invalid(self, steam_app_factory):
        steam_app = steam_app_factory(name="Fake game", appid=10)

        appmanifest_path = \
            Path(steam_app.install_path).parent.parent / "appmanifest_10.acf"
        appmanifest_path.write_text("invalid")

        # Invalid appmanifest file is ignored
        assert not SteamApp.from_appmanifest(
            path=str(appmanifest_path),
            steam_lib_paths=[]
        )
github Matoking / protontricks / tests / test_steam.py View on Github external
def test_steam_app_from_appmanifest(self, steam_app_factory, steam_dir):
        """
        Create a SteamApp from an appmanifest file
        """
        steam_app = steam_app_factory(name="Fake game", appid=10)

        appmanifest_path = \
            Path(steam_app.install_path).parent.parent / "appmanifest_10.acf"

        steam_app = SteamApp.from_appmanifest(
            path=str(appmanifest_path),
            steam_lib_paths=[str(steam_dir / "steam" / "steamapps")]
        )

        assert steam_app.name == "Fake game"
        assert steam_app.appid == 10
github Matoking / protontricks / tests / test_gui.py View on Github external
def test_select_game_no_choice(self, zenity, steam_app_factory):
        """
        Try choosing a game but make no choice
        """
        steam_apps = [steam_app_factory(name="Fake game 1", appid=10)]

        # Fake user doesn't select any game
        zenity.mock_stdout = ""

        with pytest.raises(SystemExit) as exc:
            select_steam_app_with_gui(steam_apps=steam_apps)

        assert exc.value.code == 0
github Matoking / protontricks / tests / test_gui.py View on Github external
def test_select_game_broken_zenity(self, broken_zenity, steam_app_factory):
        """
        Try choosing a game with a broken Zenity executable that
        prints a specific error message that Protontricks knows how to ignore
        """
        steam_apps = [
            steam_app_factory(name="Fake game 1", appid=10),
            steam_app_factory(name="Fake game 2", appid=20)
        ]

        # Fake user selecting 'Fake game 2'
        broken_zenity.mock_stdout = "Fake game 2: 20"
        steam_app = select_steam_app_with_gui(steam_apps=steam_apps)

        assert steam_app == steam_apps[1]
github Matoking / protontricks / tests / test_gui.py View on Github external
def test_select_game(self, zenity, steam_app_factory):
        """
        Select a game using the GUI
        """
        steam_apps = [
            steam_app_factory(name="Fake game 1", appid=10),
            steam_app_factory(name="Fake game 2", appid=20)
        ]

        # Fake user selecting 'Fake game 2'
        zenity.mock_stdout = "Fake game 2: 20"
        steam_app = select_steam_app_with_gui(steam_apps=steam_apps)

        assert steam_app == steam_apps[1]
github Matoking / protontricks / tests / test_steam.py View on Github external
steam_library_factory):
        """
        Find the proton prefix directory for a game located inside
        a "SteamApps" directory instead of the default "steamapps".

        Regression test for #33.
        """
        library_dir = steam_library_factory("TestLibrary")
        steam_app_factory(name="Test game", appid=10, library_dir=library_dir)

        os.rename(
            str(library_dir / "steamapps"),
            str(library_dir / "SteamApps")
        )

        path = find_appid_proton_prefix(
            appid=10, steam_lib_paths=[str(steam_dir), str(library_dir)]
        )

        assert path == str(
            library_dir / "SteamApps" / "compatdata" / "10" / "pfx"
        )
github Matoking / protontricks / tests / test_steam.py View on Github external
# Give the copy in library B the most recent modification timestamp
        os.utime(
            str(library_dir_a / "steamapps" / "compatdata" / "10" / "pfx.lock"),
            (time.time() - 100, time.time() - 100)
        )
        os.utime(
            str(library_dir_b / "steamapps" / "compatdata" / "10" / "pfx.lock"),
            (time.time() - 25, time.time() - 25)
        )
        os.utime(
            str(library_dir_c / "steamapps" / "compatdata" / "10" / "pfx.lock"),
            (time.time() - 50, time.time() - 50)
        )

        path = find_appid_proton_prefix(
            appid=10,
            steam_lib_paths=[
                str(library_dir_a), str(library_dir_b), str(library_dir_c)
            ]
        )
        assert path == str(
            library_dir_b / "steamapps" / "compatdata" / "10" / "pfx"
        )
github Matoking / protontricks / tests / test_steam.py View on Github external
def test_get_steam_apps_custom_proton(
            self, default_proton, custom_proton_factory, steam_dir,
            steam_root):
        """
        Create a custom Proton installation and ensure
        'get_steam_apps' can find it
        """
        custom_proton = custom_proton_factory(name="Custom Proton")

        steam_apps = get_steam_apps(
            steam_root=str(steam_root),
            steam_path=str(steam_dir),
            steam_lib_paths=[str(steam_dir)]
        )

        assert len(steam_apps) == 2

        found_custom_proton = next(
            app for app in steam_apps
            if app.name == "Custom Proton"
        )
        assert found_custom_proton.install_path == \
            str(custom_proton.install_path)
github Matoking / protontricks / tests / test_steam.py View on Github external
def test_get_steam_apps_in_library_folder(
            self, default_proton, steam_library_factory, steam_app_factory,
            steam_dir, steam_root):
        """
        Create two games, one installed in the Steam installation directory
        and another in a Steam library folder
        """
        library_dir = steam_library_factory(name="GameDrive")
        steam_app_factory(name="Fake game 1", appid=10)
        steam_app_factory(
            name="Fake game 2", appid=20, library_dir=library_dir)

        steam_apps = get_steam_apps(
            steam_root=str(steam_root),
            steam_path=str(steam_dir),
            steam_lib_paths=[str(steam_dir), str(library_dir)]
        )

        # Two games and the default Proton installation should be found
        assert len(steam_apps) == 3
        steam_app_a = next(app for app in steam_apps if app.appid == 10)
        steam_app_b = next(app for app in steam_apps if app.appid == 20)

        assert steam_app_a.install_path == \
            str(steam_dir / "steamapps" / "common" / "Fake game 1")
        assert steam_app_b.install_path == \
            str(library_dir / "steamapps" / "common" / "Fake game 2")

protontricks

A simple wrapper for running Winetricks commands for Proton-enabled games.

GPL-3.0
Latest version published 3 months ago

Package Health Score

70 / 100
Full package analysis