{"id":18382582,"url":"https://github.com/virtualbrainlab/automated-unit-testing-demo","last_synced_at":"2026-05-02T06:34:34.162Z","repository":{"id":190036662,"uuid":"681756944","full_name":"VirtualBrainLab/automated-unit-testing-demo","owner":"VirtualBrainLab","description":"Demo repo for automated unit testing in Python. Use this as a reference for how to perform unit tests in Python and have GitHub Actions run them.","archived":false,"fork":false,"pushed_at":"2023-08-31T21:42:05.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-15T23:42:24.583Z","etag":null,"topics":["github-actions","python","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VirtualBrainLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-22T17:36:10.000Z","updated_at":"2023-08-25T20:20:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"8f85d352-5b0b-4da1-ab4a-d15c47da3426","html_url":"https://github.com/VirtualBrainLab/automated-unit-testing-demo","commit_stats":null,"previous_names":["virtualbrainlab/automated-unit-testing-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirtualBrainLab%2Fautomated-unit-testing-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirtualBrainLab%2Fautomated-unit-testing-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirtualBrainLab%2Fautomated-unit-testing-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirtualBrainLab%2Fautomated-unit-testing-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirtualBrainLab","download_url":"https://codeload.github.com/VirtualBrainLab/automated-unit-testing-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248481872,"owners_count":21111231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","python","unit-testing"],"created_at":"2024-11-06T01:06:58.140Z","updated_at":"2026-05-02T06:34:34.126Z","avatar_url":"https://github.com/VirtualBrainLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automated Unit Testing Demo\n\n[![Unit Tests](https://github.com/VirtualBrainLab/automated-unit-testing-demo/actions/workflows/test.yml/badge.svg)](https://github.com/VirtualBrainLab/automated-unit-testing-demo/actions/workflows/test.yml)\n\nDemo repo for automated unit testing in Python. Use this as a reference for how to perform unit tests in Python and have\nGitHub Actions run them.\n\n## Install and run the demo code\n\n1. Clone this repo: `git clone https://github.com/VirtualBrainLab/automated-unit-testing-demo.git`\n2. (Optional) create a virtual environment: `python -m venv venv`\n3. Install the package: `pip install -e .`\n4. Run the demo script: `demo`\n5. Run the unit tests: `python -m unittest discover -s tests`\n\n## Work through writing tests\n\nThis repo has branches labeled `0-...` through `5-...` which highlight steps in the process of writing code and unit\ntests. They can be visited (in no particular order) with `git checkout` or `git switch` to experiment wth writing tests\nand see the code at different states. On the `main` branch you can see the finished product including GitHub Actions\nworkflow and branch protection.\n\n| Branch           | Description                                                                  | Activity                                          |\n|------------------|------------------------------------------------------------------------------|---------------------------------------------------|\n| `0-start`        | Demo class code with no unit tests.                                          | Write tests for `DemoClass` from scratch.         |\n| `1-weak-tests`   | Basic unit test. Demonstrates the `TestCase` class structure.                | Improve the tests given.                          |\n| `2-code-change`  | `DemoClass`'s code got changed! Does the unit tests catch the bugs (if any)? | Write tests to catch the bugs introduced.         |\n| `3-better-tests` | Improved unit tests to expose the bugs.                                      | Fix the bugs introduced in `DemoClass`            |\n| `4-fixed-code`   | Fixed the bugs introduced earlier.                                           | Think of inputs that can trigger uncaught errors. |\n| `5-error-tests`  | Added tests that check for bad inputs.                                       | Write a GitHub Action workflow from scratch.      |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtualbrainlab%2Fautomated-unit-testing-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirtualbrainlab%2Fautomated-unit-testing-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtualbrainlab%2Fautomated-unit-testing-demo/lists"}