From 0bca270c51205ca111850533d603ae793e42a909 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 16:48:41 -0700 Subject: [PATCH 01/24] pytest setting to run in top directory --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c1e1f36..8dc1335 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,3 +20,8 @@ classifiers = [ [project.urls] "Homepage" = "https://github.com/davidpanderson/Numula" "Bug Tracker" = "https://github.com/davidpanderson/Numula/issues" + +[tool.pytest.ini_options] +pythonpath = [ + "." +] From a22c5b2c1499147cfcdc5193506e7bffe0bc1f1e Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 16:49:10 -0700 Subject: [PATCH 02/24] don't pollute git with cache directories --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ From 631bc81c1c4a3c9156b47eb689ae1e85f7d94e01 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 17:28:14 -0700 Subject: [PATCH 03/24] getting started with py.test --- examples/{audio_test.py => audio_try.py} | 0 examples/{curve_test.py => curve_try.py} | 0 examples/test_notate.py | 2 +- examples/test_note.py | 2 +- examples/{test_midifile.py => try_midifile.py} | 0 examples/{test_nuance.py => try_nuance_pianoteq.py} | 0 6 files changed, 2 insertions(+), 2 deletions(-) rename examples/{audio_test.py => audio_try.py} (100%) rename examples/{curve_test.py => curve_try.py} (100%) rename examples/{test_midifile.py => try_midifile.py} (100%) rename examples/{test_nuance.py => try_nuance_pianoteq.py} (100%) diff --git a/examples/audio_test.py b/examples/audio_try.py similarity index 100% rename from examples/audio_test.py rename to examples/audio_try.py diff --git a/examples/curve_test.py b/examples/curve_try.py similarity index 100% rename from examples/curve_test.py rename to examples/curve_try.py diff --git a/examples/test_notate.py b/examples/test_notate.py index 6f6e9da..40026be 100644 --- a/examples/test_notate.py +++ b/examples/test_notate.py @@ -22,6 +22,6 @@ def test1(): ns = Score() ns.append_score([n(s)]) print(ns) - ns.write_midi('data/test1.midi') + ns.write_midi('./examples/data/test1.midi') test1() diff --git a/examples/test_note.py b/examples/test_note.py index 6f0a8f0..69efba5 100644 --- a/examples/test_note.py +++ b/examples/test_note.py @@ -20,7 +20,7 @@ def test1(): ns = Score(n('c d e f g a b c')) ns.insert_pedal(PedalUse(4/4, 3/4, True)) - ns.write_midi('data/test1.midi') + ns.write_midi('./examples/data/test1.midi') test1() diff --git a/examples/test_midifile.py b/examples/try_midifile.py similarity index 100% rename from examples/test_midifile.py rename to examples/try_midifile.py diff --git a/examples/test_nuance.py b/examples/try_nuance_pianoteq.py similarity index 100% rename from examples/test_nuance.py rename to examples/try_nuance_pianoteq.py From 50e373ec6996921c4d6161c30c108d3e715898b9 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 17:28:30 -0700 Subject: [PATCH 04/24] automate testing on Travis --- .travis.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b628dc3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: python +python: + - 3.8 + - 3.9 + - 3.10 +before_install: + - python --version + - pip install -U pip + - pip install -U pytest + - pip install -U mido + - pip install codecov +install: + - pip install ".[test]" . # install package + test dependencies +script: pytest # run tests +after_success: + - codecov # submit coverage + From a7d525a5f4c294e272dbe89129781237118e3bf3 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 17:43:05 -0700 Subject: [PATCH 05/24] Travis has changed substantially, it's useless now --- .travis.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b628dc3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: python -python: - - 3.8 - - 3.9 - - 3.10 -before_install: - - python --version - - pip install -U pip - - pip install -U pytest - - pip install -U mido - - pip install codecov -install: - - pip install ".[test]" . # install package + test dependencies -script: pytest # run tests -after_success: - - codecov # submit coverage - From 3f9565584c8ac2dbff489a85ef7d61ff57778204 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 17:45:07 -0700 Subject: [PATCH 06/24] let's run test with github actions --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4ccaeca --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Run Python Tests +on: + push: + branches: + - master + - tests + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/[email protected] + - name: Install Python 3 + uses: actions/[email protected] + with: + python-version: 3.10 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mido + - name: Run tests with pytest + run: pytest From 52297ce7272558d19381a37c46e8a25e8dc06aa0 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 17:49:00 -0700 Subject: [PATCH 07/24] badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a11693f..2847654 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +![Tests](https://github.com/davidedelvento/Numula/.github/workflows/ci.yml/badge.svg) + + Numula: a Python library for creating nuanced music with MIDI. See [the Wiki](https://github.com/davidpanderson/Numula/wiki) From f89a846f5e2727ab04229b48abc5cc3b8a1694fa Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 19:58:36 -0700 Subject: [PATCH 08/24] trying to understand this syntax, sigh --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ccaeca..3b0ef3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/[email protected] - name: Install Python 3 - uses: actions/[email protected] with: python-version: 3.10 - name: Install dependencies From 8407bcd21b6951d27aef93982a274893f9601a11 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:01:12 -0700 Subject: [PATCH 09/24] mmmmm --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b0ef3b..620ec7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Python 3 - with: - python-version: 3.10 + run: | + apt-get install python -y - name: Install dependencies run: | python -m pip install --upgrade pip From 7a7a2e811a1ded300e454600fe088abecf327811 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:04:53 -0700 Subject: [PATCH 10/24] why did they make it so?? --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 620ec7b..31abedf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Install Python 3 run: | - apt-get install python -y + sudo apt-get install python - name: Install dependencies run: | python -m pip install --upgrade pip From 7d68002de48b087633a12175135eb0f3262d7b13 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:06:15 -0700 Subject: [PATCH 11/24] In Ubuntu Python is still v2, sigh --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31abedf..71ee1c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,10 @@ jobs: steps: - name: Install Python 3 run: | - sudo apt-get install python + sudo apt-get install python3 - name: Install dependencies run: | - python -m pip install --upgrade pip + python3 -m pip install --upgrade pip pip install mido - name: Run tests with pytest run: pytest From d0e08b3d36d47f2bbb82c8040c94f8a6717769ac Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:07:18 -0700 Subject: [PATCH 12/24] Requesting py.test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71ee1c6..3d5e558 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,6 @@ jobs: - name: Install dependencies run: | python3 -m pip install --upgrade pip - pip install mido + pip install mido pytest - name: Run tests with pytest run: pytest From bb82b38d1be17af2d263d323ad87071d6aa3bfe9 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:08:37 -0700 Subject: [PATCH 13/24] In what directory is this running? --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d5e558..d81dd33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,4 +20,7 @@ jobs: python3 -m pip install --upgrade pip pip install mido pytest - name: Run tests with pytest - run: pytest + run: | + ls + ls .. + pytest From 14df8067a67b9230e84babc366d8307a23b93697 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:12:30 -0700 Subject: [PATCH 14/24] badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2847654..e445371 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -![Tests](https://github.com/davidedelvento/Numula/.github/workflows/ci.yml/badge.svg) + +[![Run Python Tests](https://github.com/davidedelvento/Numula/actions/workflows/ci.yml/badge.svg)](https://github.com/davidedelvento/Numula/actions/workflows/ci.yml) Numula: a Python library for creating nuanced music with MIDI. From 1c55547e61d64cae0670cad56ce3218c31bb0f54 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:12:47 -0700 Subject: [PATCH 15/24] figuring it out why it does not find tests --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d81dd33..34bf82e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,5 @@ jobs: pip install mido pytest - name: Run tests with pytest run: | - ls - ls .. + ls -l examples/ pytest From 6442e370b17f00d9838312e1a83c6a076ce1fe82 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:19:52 -0700 Subject: [PATCH 16/24] how tedious --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34bf82e..b202b7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,4 +22,5 @@ jobs: - name: Run tests with pytest run: | ls -l examples/ + ls -l . pytest From b6e0ea8c589ce1956784e48ad0894c0dfe614507 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:20:59 -0700 Subject: [PATCH 17/24] last try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b202b7a..d11885b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,6 @@ jobs: pip install mido pytest - name: Run tests with pytest run: | - ls -l examples/ ls -l . + ls -l examples/ pytest From 62e6b8c0cc3e66a23dca9142501f572c52a540aa Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:22:04 -0700 Subject: [PATCH 18/24] empty dir? --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d11885b..6dae2c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ jobs: pip install mido pytest - name: Run tests with pytest run: | - ls -l . + ls -l .. + ls -l ../.. ls -l examples/ pytest From db5794947b4e335ee476303778caa858d68f3977 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:26:30 -0700 Subject: [PATCH 19/24] very weird --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dae2c0..a98787c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,9 @@ jobs: pip install mido pytest - name: Run tests with pytest run: | + cd .. + echo "uffa" + ls -l . + echo "boring" ls -l .. - ls -l ../.. - ls -l examples/ pytest From cff4f3f80cb3a59128fd1a46e537195077591af3 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:29:59 -0700 Subject: [PATCH 20/24] checkout --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a98787c..f2998f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ jobs: build: runs-on: ubuntu-latest steps: + - uses: actions/checkout - name: Install Python 3 run: | sudo apt-get install python3 From e3e66714c527cbd06ac5583fc370ec254c376502 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:31:54 -0700 Subject: [PATCH 21/24] must specify v3 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2998f4..9761f62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout + - uses: actions/checkout@v3 - name: Install Python 3 run: | sudo apt-get install python3 From 2cbfd4b47e3c32339c61f63b9ab0af0153eb6bf6 Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:33:03 -0700 Subject: [PATCH 22/24] removing change of directory --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9761f62..02781d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,9 +22,4 @@ jobs: pip install mido pytest - name: Run tests with pytest run: | - cd .. - echo "uffa" - ls -l . - echo "boring" - ls -l .. pytest From 419f51d48336cb8129badc5834eb8457f9d1dc2a Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:34:24 -0700 Subject: [PATCH 23/24] numpy --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02781d1..1390239 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Install dependencies run: | python3 -m pip install --upgrade pip - pip install mido pytest + pip install mido pytest numpy - name: Run tests with pytest run: | pytest From 2db405271d1f1a65faa789afce6575bd90815c4e Mon Sep 17 00:00:00 2001 From: Davide Del Vento Date: Sun, 6 Nov 2022 20:36:36 -0700 Subject: [PATCH 24/24] requirements --- .github/workflows/ci.yml | 3 ++- requirements.txt | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1390239..44965f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,8 @@ jobs: - name: Install dependencies run: | python3 -m pip install --upgrade pip - pip install mido pytest numpy + pip install pytest + pip install -r requirements.txt - name: Run tests with pytest run: | pytest diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6bdca25 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +numpy +mido