-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds github action to run tests on PR adds two parameters to specify custom output files restructures packages (again) because I noticed errors when trying to use this in our library fixes pypi tests, they were not properly testing the installation from testpypi but simply using the local files Co-authored-by: Ben Hurdelhey <Ben.Hurdelhey@vm-midea03.eaalab.hpi.uni-potsdam.de> Co-authored-by: Christopher Hagedorn <christopher.schmidt1989@gmail.com>
- Loading branch information
1 parent
3b001d2
commit 0422487
Showing
39 changed files
with
127 additions
and
79 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Run tests | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- name: Install pytest | ||
run: | | ||
python3 -m pip install pytest --user | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install . | ||
- name: Test with pytest | ||
run: | | ||
pytest --ignore test/test_manm_cs_pypi.py |
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 |
---|---|---|
|
@@ -138,3 +138,6 @@ data | |
graph | ||
ground_truth*.gml | ||
samples*.csv | ||
data.csv | ||
graph.gml | ||
test_pypi |
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
File renamed without changes.
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
File renamed without changes.
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
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/manm_cs/noise/continous_noise.py → manm_cs/noise/continous_noise.py
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
4 changes: 2 additions & 2 deletions
4
src/manm_cs/noise/discrete_noise.py → manm_cs/noise/discrete_noise.py
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
4 changes: 2 additions & 2 deletions
4
src/manm_cs/noise/discrete_noise_builder.py → manm_cs/noise/discrete_noise_builder.py
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
4 changes: 2 additions & 2 deletions
4
src/manm_cs/noise/gaussian_noise_builder.py → manm_cs/noise/gaussian_noise_builder.py
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
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
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,4 @@ | ||
from manm_cs.prob_distributions.continuous import GaussianDistribution | ||
from manm_cs.prob_distributions.discrete import BinomialDistribution | ||
from manm_cs.prob_distributions.discrete import CustomDiscreteDistribution | ||
from manm_cs.prob_distributions.discrete import UniformDiscreteDistribution |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...utions/continuous/bimodal_distribution.py → ...utions/continuous/bimodal_distribution.py
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
8 changes: 8 additions & 0 deletions
8
manm_cs/prob_distributions/continuous/continuous_distribution.py
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,8 @@ | ||
from abc import ABC | ||
|
||
from manm_cs.prob_distributions.prob_distribution import ProbDistribution | ||
from manm_cs.variables import VariableType | ||
|
||
|
||
class ContinuousDistribution(ProbDistribution, ABC): | ||
type = VariableType.CONTINUOUS |
2 changes: 1 addition & 1 deletion
2
...tions/continuous/gaussian_distribution.py → ...tions/continuous/gaussian_distribution.py
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...butions/discrete/binomial_distribution.py → ...butions/discrete/binomial_distribution.py
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
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
4 changes: 2 additions & 2 deletions
4
...butions/discrete/discrete_distribution.py → ...butions/discrete/discrete_distribution.py
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
4 changes: 2 additions & 2 deletions
4
.../discrete/random_discrete_distribution.py → .../discrete/random_discrete_distribution.py
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
2 changes: 1 addition & 1 deletion
2
...discrete/uniform_discrete_distribution.py → ...discrete/uniform_discrete_distribution.py
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
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
File renamed without changes.
File renamed without changes.
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
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
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
File renamed without changes.
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
Empty file.
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
src/manm_cs/prob_distributions/continuous/continuous_distribution.py
This file was deleted.
Oops, something went wrong.
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
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 @@ | ||
import os | ||
import time | ||
|
||
ground_truth = "graph" | ||
samples = "data" | ||
test_folder = "test_pypi" | ||
|
||
def test_manm_cs(): | ||
os.system( | ||
"python3 -m pip install . &&" + # install dependencies from actual pip because they are not on testpypi | ||
f"mkdir -p {test_folder} && cd {test_folder} && rm -f {samples} {ground_truth} &&" + | ||
f"python3 -m manm_cs --num_nodes 10 --edge_density 0.5 --num_samples 10000 --discrete_node_ratio 0.5 --output_ground_truth_file \"{ground_truth}\" --output_samples_file \"{samples}\"") | ||
|
||
assert os.path.isfile(test_folder + "/" + ground_truth + ".gml") | ||
assert os.path.isfile(test_folder + "/" + samples + ".csv") |
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,20 +1,18 @@ | ||
import os | ||
import time | ||
|
||
ground_truth = "./ground_truth.gml" | ||
samples = "./samples.csv" | ||
ground_truth = "graph" | ||
samples = "data" | ||
test_folder = "test_pypi" | ||
|
||
def test_manm_cs_pypi(): | ||
|
||
if os.path.isfile(ground_truth): | ||
os.rename(ground_truth, f"./ground_truth_old_{int(time.time())}.gml") | ||
if os.path.isfile(samples): | ||
os.rename(samples, f"./samples_old{int(time.time())}.csv") | ||
|
||
os.system( | ||
"python3 -m pip install . &&" + # install dependencies from actual pip because they are not on testpypi | ||
f"mkdir -p {test_folder} && cd {test_folder} && rm -f {samples} {ground_truth} && " + | ||
"python3 -m pip uninstall -y manm-cs &&" + # uninstall the package itself so we can install it from testpypi | ||
"python3 -m pip install -i https://test.pypi.org/simple/ manm-cs &&" + # install latest manm-cs from testpypi | ||
"python3 -m manm_cs --num_nodes 10 --edge_density 0.5 --num_samples 10000 --discrete_node_ratio 0.5") | ||
f"python3 -m manm_cs --num_nodes 10 --edge_density 0.5 --num_samples 10000 --discrete_node_ratio 0.5 --output_ground_truth_file \"{ground_truth}\" --output_samples_file \"{samples}\"") | ||
|
||
assert os.path.isfile(ground_truth) | ||
assert os.path.isfile(samples) | ||
assert os.path.isfile(test_folder + "/" + ground_truth + ".gml") | ||
assert os.path.isfile(test_folder + "/" + samples + ".csv") |