-
Notifications
You must be signed in to change notification settings - Fork 71
Home
Welcome to the python-valve wiki!
Tests depend on pytest (>=2.4) and Mock (==1.0.1). The tests can be thought of being split into unit tests and functional tests. The unit tests are just that: unit tests. They test the smallest testable units of the library. The target for unit test coverage is 100%.
Along side the unit tests are (will be :D) a number of functional tests which run the library against actual Valve services/products. For valve.source
tests can be run against Source Dedicated Server (SRCDS) instances if they're installed.
In order to run the functional tests against SRCDS instances there must be a little bit of setup before hand. Firstly there must be at least one SRCDS installed. This can be done through SteamCMD. The Valve wiki page goes over how to do this, but ...
Create a directory to hold all the SteamCMD/SRCDS stuff (you'll need rwx permissions)
$ mkdir /opt/srcds && cd /opt/srcds
Acquire a copy of SteamCMD
$ wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
Extract from the archive
$ tar -xzf steamcmd_linux.tar.gz
Run SteamCMD, letting it update it self
$ ./steamcmd.sh
Login to Steam
Steam> login anonymous
Set the install directory. The instances/
component matters. <SYMBOLIC NAME>
should be replaced with a name identifies the type of server. E.g. tf2
for a Team Fortress 2 server.
Steam> force_install_dir instances/<SYMBOLIC NAME>
Install server. <APP ID>
should be application ID of the server you want to install. This may take a while.
Steam> app_update <APP ID>
Exit SteamCMD
Steam> quit
Set the PYTHON_VALVE_SRCDS
environment variable to the directory containing the instances/
directory.
export PYTHON_VALVE_SRCDS=/opt/srcds
Run the tests. The --srcds
option controls which SRCDS instances the tests are run against. The value should be a comma-separated list of <SYMBOLIC NAME>
s (the name of the directories in instances/
.)
py.test path/to/tests/valve --srcds=<SYMBOLIC NAME>