This documentation provides a step-by-step guide for running tests in the moj-analytical-services/splink_demos
project. This guide includes necessary setups, commands, and code examples to facilitate running tests effectively.
Prerequisites
Before executing the tests, ensure that the following prerequisites are satisfied:
Java Installation: The project requires Java to run
pyspark
. To install Java, download the appropriate version for your operating system from the official website.Verify Java Installation: To confirm that Java has been installed correctly, open a terminal and execute the following command:
java -version
This will display your Java installation details. If you have multiple Java installations, ensure that the correct version is being used.
Python Version: Ensure you are using Python 3.10, as specified in the project’s
runtime.txt
file.
Cloning the Repository
To download the example notebooks and setup the environment, clone the repository using the following command:
git clone https://github.com/moj-analytical-services/splink_demos.git
Change into the cloned directory:
cd splink_demos
Setting Up the Python Environment
Create a virtual environment for the project to isolate the dependencies:
python3 -m venv venv
source venv/bin/activate
This will activate the newly created virtual environment.
Installing Dependencies
Ensure all the necessary packages, including pyspark
, are installed by executing:
pip3 install -r requirements.txt
Running Tests
Once the environment is set up and dependencies are installed, you can run the tests. The project appears to use Jupyter notebooks for some of its testing. You can run these notebooks interactively:
Start Jupyter Notebook: In the terminal, run the following command to start Jupyter Notebook:
jupyter notebook
Open and Run Notebooks: This will open a web interface in your browser. Navigate to the relevant notebook file(s) that include tests and run them interactively.
Alternatively, if there are Python scripts designed for testing, you can run them directly from the command line. For example, if a test script is provided as test_script.py
, run the following command:
python test_script.py
Make sure to replace test_script.py
with the actual name of your test script.
Conclusion
Following the steps above will enable you to successfully prepare and run tests for the moj-analytical-services/splink_demos
project.
For further details on the specific tests and implementations within the notebooks, please reference the individual notebook files or documentation contained within the repository.