Skip to content

Commit

Permalink
Add test for conversion of BaseCEnum to c_int
Browse files Browse the repository at this point in the history
Test for implicit conversion to c_int which is deprecated in Python3.11.
Use Pytest to run tests, and remove unused/old tests.
  • Loading branch information
larsevj committed Jan 24, 2024
1 parent 2f30c6d commit d88daea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 128 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Test
run: |
python -m unittest discover -v -s tests
pytest tests -v
publish:
Expand All @@ -41,12 +41,12 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
14 changes: 11 additions & 3 deletions tests/test_basecenum.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import ctypes
from cwrap import BaseCEnum, Prototype, load
import os
import unittest

from cwrap import BaseCEnum, Prototype, load


class BaseCEnumTest(unittest.TestCase):
def test_base_c_enum(self):
class enum(BaseCEnum):
Expand Down Expand Up @@ -121,3 +120,12 @@ class Endumb(BaseCEnum):

Endumb.addEnum("SOME_VALUE", -1)
assert Endumb.SOME_VALUE.abs() == 1

def test_base_c_enum_to_c_int():
class NumberEnum(BaseCEnum):
pass

NumberEnum.addEnum("ONE", 1)

c_int_value = ctypes.c_int(NumberEnum.ONE)
assert c_int_value.value == NumberEnum.ONE
122 changes: 0 additions & 122 deletions tests/test_metawrap.py

This file was deleted.

0 comments on commit d88daea

Please sign in to comment.