Skip to content
Snippets Groups Projects
Commit 6279883b authored by Mayr, Hannes's avatar Mayr, Hannes
Browse files

Merge branch 'packaging' into 'version0.1'

Packaging

See merge request !9
parents 198d707d 022474de
No related branches found
No related tags found
4 merge requests!12v.0.1 for alpha release,!11Draft: Merge version0.1 changes into dev,!10Version0.1,!9Packaging
Pipeline #734650 passed
This commit is part of merge request !11. Comments created here will be created in the context of that merge request.
Showing with 55 additions and 13 deletions
.coveragerc 0 → 100644
[run]
omit =
*example.py
*/usr/*
......@@ -48,7 +48,7 @@ PEP8:
Pylint:
stage: linting
# allow_failure: true
script: find . -type f -name '*.py' | xargs pylint -rn --fail-under=9 # Find all python files and check the code with pylint.
script: find src/plotid/ tests/ -type f -name '*.py' | xargs pylint -rn --fail-under=9 # Find all python files and check the code with pylint.
test:
stage: testing
......@@ -56,7 +56,7 @@ test:
- docker
script:
# - python -m unittest discover -s ./tests/ -p "test*" # deprecated unittest command
- python runner_tests.py
- python tests/runner_tests.py
# - pip install tox flake8 # you can also use tox
# - tox -e py36,flake8
......
.pylintrc 0 → 100644
[MASTER]
init-hook='import sys; sys.path.append("./src/plotid")'
pyproject.toml 0 → 100644
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
setup.cfg 0 → 100644
[metadata]
name = example-package-plotid-test
version = 0.0.1
author = Example Author
author_email = author@example.com
description = A small example package
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pypa/sampleproject
project_urls =
Bug Tracker = https://github.com/pypa/sampleproject/issues
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
[options]
package_dir =
= src
packages = find:
python_requires = >=3.10
[options.packages.find]
where = src
[MASTER]
init-hook='import sys; sys.path.append("./src/plotid")'
File moved
......@@ -57,5 +57,7 @@ for i, figure in enumerate(figs):
figure.savefig(name)
# %% Publish
publish('tests', '/home/chief/Dokumente/fst/plotid_python/data',
# Arguments: Source directory, destination directory, figure, plot (which is
# already saved as picture, publish-mode).
publish('../../tests', '/home/chief/Dokumente/fst/plotid_python/data',
fig1, 'Bild', 'individual')
File moved
File moved
File moved
File moved
File moved
File moved
File moved
......@@ -8,15 +8,19 @@ Includes starting all tests and measuring the code coverage.
import sys
import unittest
import coverage
import os
path = os.path.abspath('src/plotid')
sys.path.append(path)
cov = coverage.Coverage()
cov.start()
loader = unittest.TestLoader()
tests = loader.discover('tests')
tests = loader.discover('.')
testRunner = unittest.runner.TextTestRunner(verbosity=2)
result = testRunner.run(tests)
cov.stop()
cov.save()
cov.report(show_missing=True)
......
......@@ -5,7 +5,7 @@ Unittests for CreateID
"""
import unittest
from create_id import create_id
import src.plotid.create_id as cid
class TestCreateID(unittest.TestCase):
......@@ -15,20 +15,20 @@ class TestCreateID(unittest.TestCase):
def test_existence(self):
"""Test if create_id returns a string."""
self.assertIsInstance(create_id(1), str)
self.assertIsInstance(create_id(2), str)
self.assertIsInstance(cid.create_id(1), str)
self.assertIsInstance(cid.create_id(2), str)
def test_errors(self):
""" Test if Errors are raised when id_method is wrong. """
with self.assertRaises(ValueError):
create_id(3)
cid.create_id(3)
with self.assertRaises(ValueError):
create_id('h')
cid.create_id('h')
def test_length(self):
""" Test if figure_id has the correct length. """
self.assertEqual(len(create_id(1)), 10)
self.assertEqual(len(create_id(2)), 8)
self.assertEqual(len(cid.create_id(1)), 10)
self.assertEqual(len(cid.create_id(2)), 8)
if __name__ == '__main__':
......
......@@ -10,7 +10,8 @@ import sys
import shutil
from unittest.mock import patch
import matplotlib.pyplot as plt
from publish import publish
from src.plotid.publish import publish
SRC_DIR = 'test_src_folder'
PIC_NAME = 'test_picture'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment