Skip to content

Commit 794fa9d

Browse files
committed
Fix: style tables and remove old test table image
1 parent 0e96047 commit 794fa9d

File tree

3 files changed

+92
-7
lines changed

3 files changed

+92
-7
lines changed

_static/pyos.css

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
/* anything related to the dark theme */
2222
html[data-theme="dark"] {
2323
--pst-color-info-bg: #400f59!important;
24+
--pst-color-tbl-row: #2E2E2E!important;
25+
}
26+
27+
/* anything related to the light theme */
28+
html[data-theme="light"] {
29+
--pst-color-tbl-row: #E1DEE9!important;
30+
}
2431
}
2532

2633

@@ -331,3 +338,45 @@ aside.footnote {
331338
background-color: var(--pst-color-target);
332339
}
333340
}
341+
342+
.fa-circle-check {
343+
color: #49b7b9;
344+
}
345+
346+
/* pyOpenSci table styles */
347+
348+
.pyos-table {
349+
& th.head, .pyos-table th.head.stub {
350+
background-color: #33205C!important;
351+
352+
& p {
353+
color: #fff
354+
}
355+
}
356+
& th.stub {
357+
background-color: var(--pst-color-tbl-row);
358+
font-weight: 500;
359+
}
360+
& td {
361+
vertical-align: middle;
362+
text-align: center;
363+
}
364+
}
365+
366+
367+
/* Make the first column in a table a "header" like thing */
368+
369+
370+
/* Dark mode fix for tables */
371+
@media (prefers-color-scheme: dark) {
372+
td:not(.row-header):nth-child(1) {
373+
background-color: var(--pst-color-tbl-row); /* Adjust the dark mode color */
374+
color: #ffffff; /* Adjust the text color for better contrast */
375+
font-weight: 500;
376+
}
377+
}
378+
379+
td, th {
380+
border: 1px solid #ccc; /* Light gray border */
381+
padding: 8px; /* Add some padding for better readability */
382+
}

images/python-package-test-tools.png

-93.8 KB
Binary file not shown.

tests/run-tests.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,51 @@ There are three types of tools that will make is easier to setup and run your te
1919
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.
2020
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).
2121

22-
:::{figure-md}
23-
![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)
24-
25-
There are three types of tools that will help you develop and run your tests. Test frameworks like pytest
26-
provide syntax and a **framework** for you to write and
27-
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.
28-
22+
:::{list-table} Table: Testing & Automation Tool
23+
:widths: 40 15 15 15 15
24+
:header-rows: 1
25+
:align: center
26+
:stub-columns: 1
27+
:class: pyos-table
28+
29+
* - Features
30+
- Testing Framework (pytest)
31+
- Test Runner (Tox)
32+
- Automation Tools (Nox)
33+
- Continuous Integration (GitHub Actions)
34+
* - Run Tests Locally
35+
- <i class="fa-solid fa-circle-check fa-xl"></i>
36+
- <i class="fa-solid fa-circle-check fa-xl"></i>
37+
- <i class="fa-solid fa-circle-check fa-xl"></i>
38+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
39+
* - Run Tests Online
40+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
41+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
42+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
43+
- <i class="fa-solid fa-circle-check fa-xl"></i>
44+
* - Run Tests Across Python Versions
45+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
46+
- <i class="fa-solid fa-circle-check fa-xl"></i>
47+
- <i class="fa-solid fa-circle-check fa-xl"></i>
48+
- <i class="fa-solid fa-circle-check fa-xl"></i>
49+
* - Run Tests In Isolated Environments
50+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
51+
- <i class="fa-solid fa-circle-check fa-xl"></i>
52+
- <i class="fa-solid fa-circle-check fa-xl"></i>
53+
- <i class="fa-solid fa-circle-check fa-xl"></i>
54+
* - Run Tests Across Operating Systems (Windows, MacOS, Linux)
55+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
56+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
57+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
58+
- <i class="fa-solid fa-circle-check fa-xl"></i>
59+
* - Use for other automation tasks (e.g. building docs)
60+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
61+
- <i class="fa-solid fa-xmark fa-xl" style="color: #afb3bb;"></i>
62+
- <i class="fa-solid fa-circle-check fa-xl"></i>
63+
- <i class="fa-solid fa-circle-check fa-xl"></i>
2964
:::
3065

66+
3167
## What testing framework / package should I use to run tests?
3268

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

0 commit comments

Comments
 (0)