Skip to content

Commit

Permalink
Fix: style tables and remove old test table image
Browse files Browse the repository at this point in the history
  • Loading branch information
lwasser committed Jan 10, 2024
1 parent 0e96047 commit 794fa9d
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 7 deletions.
49 changes: 49 additions & 0 deletions _static/pyos.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
/* anything related to the dark theme */
html[data-theme="dark"] {
--pst-color-info-bg: #400f59!important;
--pst-color-tbl-row: #2E2E2E!important;
}

/* anything related to the light theme */
html[data-theme="light"] {
--pst-color-tbl-row: #E1DEE9!important;
}
}


Expand Down Expand Up @@ -331,3 +338,45 @@ aside.footnote {
background-color: var(--pst-color-target);
}
}

.fa-circle-check {
color: #49b7b9;
}

/* pyOpenSci table styles */

.pyos-table {
& th.head, .pyos-table th.head.stub {
background-color: #33205C!important;

& p {
color: #fff
}
}
& th.stub {
background-color: var(--pst-color-tbl-row);
font-weight: 500;
}
& td {
vertical-align: middle;
text-align: center;
}
}


/* Make the first column in a table a "header" like thing */


/* Dark mode fix for tables */
@media (prefers-color-scheme: dark) {
td:not(.row-header):nth-child(1) {
background-color: var(--pst-color-tbl-row); /* Adjust the dark mode color */
color: #ffffff; /* Adjust the text color for better contrast */
font-weight: 500;
}
}

td, th {
border: 1px solid #ccc; /* Light gray border */
padding: 8px; /* Add some padding for better readability */
}
Binary file removed images/python-package-test-tools.png
Binary file not shown.
50 changes: 43 additions & 7 deletions tests/run-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,51 @@ There are three types of tools that will make is easier to setup and run your te
2. **Automation tools** allow you to automate running workflows such as tests in specific ways using user-defined commands. For instance it's useful to be able to run tests across different Python versions with a single command. Tools such as [**nox**](https://nox.thea.codes/en/stable/index.html) and [**tox**](https://tox.wiki/en/latest/index.html) also allow you to run tests across Python versions. However, it will be difficult to test your build on different operating systems using only nox and tox - this is where continuous integration (CI) comes into play.
3. **Continuous Integration (CI):** is the last tool that you'll need to run your tests. CI will not only allow you to replicate any automated builds you create using nox or tox to run your package in different Python environments. It will also allow you to run your tests on different operating systems (Windows, Mac and Linux). [We discuss using CI to run tests here](tests-ci).

:::{figure-md}
![Figure showing three boxes - the first has Test Frameworks in it, the second Test Runner and the third Continuous Integration....](../images/python-package-test-tools.png)

There are three types of tools that will help you develop and run your tests. Test frameworks like pytest
provide syntax and a **framework** for you to write and
run tests. Test runners automate processes such as creating isolated environments to run your tests in, and running tests across Python versions with a single command. Finally Continuous integrate (CI) is a generic platform where you can run your tests across operating systems. CI allows you to run your tests on every PR and commit to ensure iterative checks as contributors suggest changes to your code.

:::{list-table} Table: Testing & Automation Tool
:widths: 40 15 15 15 15
:header-rows: 1
:align: center
:stub-columns: 1
:class: pyos-table

* - Features
- Testing Framework (pytest)
- Test Runner (Tox)
- Automation Tools (Nox)
- Continuous Integration (GitHub Actions)
* - Run Tests Locally
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
* - Run Tests Online
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
* - Run Tests Across Python Versions
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
* - Run Tests In Isolated Environments
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
* - Run Tests Across Operating Systems (Windows, MacOS, Linux)
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
* - Use for other automation tasks (e.g. building docs)
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
- <i class="fa-solid fa-circle-check fa-xl"></i>
:::


## What testing framework / package should I use to run tests?

We recommend using `Pytest` to build and run your package tests. Pytest is the most common testing tool used in the Python ecosystem.
Expand Down

0 comments on commit 794fa9d

Please sign in to comment.