From 5a926ba21f47182057a38e3a62d44cec22e9d373 Mon Sep 17 00:00:00 2001 From: Robin Krens Date: Sat, 10 Feb 2024 13:43:38 +0100 Subject: [PATCH] setup.py: directory setup with pytest --- flasher.py => flasher/flasher.py | 0 setup.py | 24 ++++++++++++++++++++++++ tests/test_parse.py | 8 ++++++++ 3 files changed, 32 insertions(+) rename flasher.py => flasher/flasher.py (100%) create mode 100644 setup.py create mode 100644 tests/test_parse.py diff --git a/flasher.py b/flasher/flasher.py similarity index 100% rename from flasher.py rename to flasher/flasher.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2b2880f --- /dev/null +++ b/setup.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import os +from setuptools import setup + +# Utility function to read the README file. +# Used for the long_description. It's nice, because now 1) we have a top level +# README file and 2) it's easier to type in the README file than to put a raw +# string in below ... +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +setup( + name = "flasher", + version = "0.0.1", + author = "Robin Krens", + description = ("An example of how to set up pytest"), + license = "GNU", + keywords = "example pytest", + packages=['flasher', 'tests'], + #long_description=read('README.md'), + classifiers=[ + "Development Status :: 1", + ], +) diff --git a/tests/test_parse.py b/tests/test_parse.py new file mode 100644 index 0000000..d83e629 --- /dev/null +++ b/tests/test_parse.py @@ -0,0 +1,8 @@ +from flasher.flasher import calc_sum +import pytest + +def test_calc_sum(): + assert calc_sum(0x12, ['0x00']) == (0, 0x2, 0xEC) + assert calc_sum(0x34, ['0x00']) == (0, 0x2, 0xCA) + assert calc_sum(0x00, ['0x00']) == (0, 0x02, 0xFE) + -- 2.43.0