diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 814b68d..ac7def3 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -15,7 +15,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + #python-version: [3.7, 3.8, 3.9] + python-version: [3.9] + #python-version: ["3.10", 3.11, 3.12] steps: - uses: actions/checkout@v2 @@ -25,9 +27,13 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip + # Need for python3.13: sudo apt-get install libxml2-dev libxslt-dev + # sudo apt-get install libxml2-dev libxslt-dev + python -m pip install --upgrade pip pip install . - pip install flake8 pytest + # Need for python 3.13 lxml 5.3.0 + # pip install lxml==5.3.0 + pip install flake8 pytest pyOpenSSL==24.2.1 async-timeout==4.0.3 if [ -f dev_requirements.txt ]; then pip install -r dev_requirements.txt; fi - name: Lint with flake8 run: | @@ -37,4 +43,4 @@ jobs: flake8 openleadr/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest -vv test/ + pytest -vv -o faulthandler_timeout=30 test/ diff --git a/openleadr/client.py b/openleadr/client.py index 78380a4..1beee26 100755 --- a/openleadr/client.py +++ b/openleadr/client.py @@ -1252,12 +1252,11 @@ async def _event_cleanup(self): """ Periodic task that will clean up completed and cancelled events in our memory. """ - for i in range(len(self.received_events)-1, -1, -1): - event = self.received_events[i] + for event in self.received_events: if event['event_descriptor']['event_status'] == 'cancelled' or \ utils.determine_event_status(event['active_period']) == 'completed': logger.info(f"Removing event {event} because it is no longer relevant.") - self.received_events.pop(i) + self.received_events.pop(self.received_events.index(event)) async def _poll(self): logger.debug("Now polling for new messages")