Skip to content

Latest commit

 

History

History
78 lines (50 loc) · 1.93 KB

README.md

File metadata and controls

78 lines (50 loc) · 1.93 KB

Test Driven Development Lunch and Learn Repository

This is a repository full of examples of using pytest for the BI Vis Dev Team Lunch and Learn on 25th May 2022. Check out the confluence page for the Lunch and Learn here

Feel free to clone a copy of this repository to play around with it. Please ensure you create a branch of the code to work on and keep it up to date by occasionally pulling main into your branch.

Check out the pytest documentation here.

Set up instructions

Clone the repository from GitHub and create a personal branch

If you are unfamiliar with using Git and GitHub, here is a handy tutorial.

  1. Clone the repository via https

    git clone https://github.com/josephwilson8-nhs/TDD_lunch_and_learn.git
    
  2. Create a personal branch to work off

    git checkout -b <name_of_your_branch>
    
  3. Pull in changes from main (Repeat when main is updated)

    git pull origin main
    

Set up a virtual environment to use the code within

  1. Create a virtual environment

    1. With pip venv

      python3 -m venv <env_name>
      source <env_name>/bin/activate
      pip install -r requirements.txt
      echo <env_name> >> .gitignore
    2. With conda

      conda create --name <env_name> --file requirements.txt

Running tests

  • To run all tests

    pytest
  • To run all tests in a file

    pytest test_file_name.py
  • To run all tests in a directory

    pytest testing/
  • To run tests matching a custom marker

    pytest -m marker_name

    If using a custom marker, make sure to register the marker in the pytest.ini file.