Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a plot to tests and make it downloaded from github #9

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: install test dependency
run: python3 -m pip install pytest
run: python3 -m pip install pytest matplotlib
- name: install module
run: python3 -m pip install .
- name: test
run: python3 -m pytest
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: magic_plot
path: magic_plot.pdf
retention-days: 1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ cython_debug/
#.idea/

build
install
install
*.pdf
14 changes: 14 additions & 0 deletions magic_python/tests/test_plot_magic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import matplotlib.pyplot as plt
import numpy as np

import magic_python


def test_plotting_pdf():
x = np.linspace(1, 11)
fig, ax = plt.subplots()

for a in [1, 2, 3]:
ax.plot(x, magic_python.my_magic_function(a, x), label=f"$a={a}$")
ax.legend(loc="best")
fig.savefig("magic_plot.pdf")