-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
228 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
# CI for packaging | ||
# What is continuous integration? | ||
|
||
Some works needs to happen here... | ||
|
||
on this page i think we can show various CI builds and talk about how they work. | ||
|
||
we can then in the future link to our example package where those builds run. | ||
and to tutorials | ||
|
||
below is duplicate text... | ||
|
||
## CI Environment | ||
|
||
CI Environment: When you’re ready to publish your code online, you can setup Continuous Integration (CI). A CI platform will allow you to not only run your tests on various Python versions but also different operating systems like Mac, Linux and Windows. Tools like GitHub Actions and GitLab CI/CD make it easy for you to run tests on various Python versions, and even on Windows, Mac, and Linux. CI can finally be configured to ensure that tests run on every push and pull request to your repository. This ensures that any changes made to your package are tested across operations systems and Python versions before they are merged into the main branch of your codebase. <<tests in ci link here>> | ||
|
||
By embracing these testing practices, you can ensure that your code runs as you expect it to across the diverse landscapes of user environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Code coverage | ||
|
||
Code coverage is the amount of your package's codebase that is run as a part of running your project's tests. A good rule of thumb is to ensure that \*\*every line of | ||
|
||
your code is run at least once during testing\**. However, note that good code coverage does not *guarantee\* that your package is well-tested. For example, you may run all of your lines of code, but not account for many edge-cases that users may have. Ultimately, you should think carefully about the way your package will be used, and decide whether your tests adequately cover all of that usage. | ||
|
||
A common service for analyzing code coverage is [codecov.io](https://codecov.io/). This project is free for open source tools, and will provide dashboards that tell you how much of your codebase is covered during your tests. We recommend setting up an account, and using codecov to keep track of your code coverage. | ||
|
||
```{figure} ../images/code-cov-stravalib.png | ||
:height: 450px | ||
:alt: Screenshot of the code cov service - showing test coverage for the stravalib package. in this image you can see a list of package modules and the associated number of lines and % lines covered by tests. at the top of the image you can see what branch is being evaluated and the path to the repository being shown. | ||
the Code cov platform is a useful tool if you wish to visually track code coverage. Using it you can not only get the same summary information that you can get with pytest-cov extension. You can also get a visual representation of what lines are covered by your tests and what lines are not covered. Code cove is mostly useful for evaluating unit tests and/or how much of your package code is "covered. It however will not evaluate things like integration tests and end-to-end workflows. b | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,78 @@ | ||
# Tests and data for your Python package | ||
|
||
Tests and data are important! | ||
In this section you will learn more about the importance of writing | ||
tests for you Python package. | ||
|
||
But why | ||
::::{grid} 1 1 2 2 | ||
:class-container: text-center | ||
:gutter: 3 | ||
|
||
:::{grid-item-card} | ||
:link: write-tests | ||
:link-type: doc | ||
|
||
✨ Why write tests ✨ | ||
^^^ | ||
|
||
Learn more about the art of writing tests for your Python package. | ||
Learn about why you should write tests and how they can help you and | ||
potential contributors to your project. | ||
::: | ||
|
||
:::{grid-item-card} | ||
:link: test-types | ||
:link-type: doc | ||
|
||
✨ Types of tests ✨ | ||
^^^ | ||
There are three general types of tests that you can write for your Python | ||
package: unit tests, integration tests and end-to-end (or functional) tests. Learn about all three. | ||
::: | ||
|
||
:::{grid-item-card} | ||
:link: run-tests | ||
:link-type: doc | ||
|
||
✨ How to Run Your Tests ✨ | ||
^^^ | ||
|
||
Learn more about what tools you can use to run tests. And how to run your | ||
tests on different Python versions and different operating systems both on | ||
your computer and using continuous integration on GitHub (or in any other CI). | ||
::: | ||
|
||
:::{grid-item-card} | ||
:link: data | ||
:link-type: doc | ||
|
||
✨ Package data ✨ | ||
^^^ | ||
This section is current in progress... link coming soon | ||
::: | ||
|
||
:::{grid-item-card} | ||
:link: ci | ||
:link-type: doc | ||
|
||
✨ Continuous Integration ✨ | ||
^^^ | ||
More on this coming soon... What is Continuous Integration? How do I set | ||
it up for my project? | ||
::: | ||
:::: | ||
|
||
```{toctree} | ||
:hidden: | ||
:maxdepth: 2 | ||
:caption: Tests and data | ||
Intro <self> | ||
Writing tests <tests> | ||
Test types: unit, integration, functional <test-types> | ||
Run tests in CI & locally <run-tests> | ||
Writing tests <write-tests> | ||
Test types <test-types> | ||
Run tests locally <run-tests> | ||
Run tests in CI <tests-ci> | ||
Code coverage <code-cov> | ||
Package data <data> | ||
CI <ci> | ||
Intro to CI <ci> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.