You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tests failing on fresh install: TypeError in test_spi.py and test_uart.py #257
Hi! I am setting up the development environment for GSoC. While running the tests locally on Windows, I encountered errors in the SPI and UART test modules.
It appears that SPIMaster._frequency and UART._baudrate are methods (functions), but the test code attempts to multiply/divide them directly as if they were integers. This causes the test collection to fail.
Steps to reproduce the behavior:
Clone repository
Install dependencies: pip install -e .
Run tests: python -m pytest
Error Log
___________________________________________________________________ ERROR collecting tests/test_spi.py ____________________________________________________________________ tests\test_spi.py:33: in PWM_FERQUENCY = SPIMaster._frequency * 2 / 3 E TypeError: unsupported operand type(s) for *: 'method' and 'int'
___________________________________________________________________ ERROR collecting tests/test_uart.py ___________________________________________________________________ tests\test_uart.py:19: in PWM_FERQUENCY = UART._baudrate // 2 E TypeError: unsupported operand type(s) for //: 'method' and 'int'
Expected behavior
The tests should collect and run without TypeErrors.
I was also exploring this issue as part of my GSoC 2026 preparation
and learned a lot about the SPI/UART test setup.
Looking forward to contributing to PSLab in other areas.
The TypeError was happening because the tests were trying to do math on the method object itself instead of its return value.
I have updated the tests to use realistic static values (100kHz for SPI, 500kHz for UART), which resolves the crash on fresh install.
Activity
saadiqbal09 commentedon Dec 25, 2025
Thanks for the detailed analysis and fix!
I was also exploring this issue as part of my GSoC 2026 preparation
and learned a lot about the SPI/UART test setup.
Looking forward to contributing to PSLab in other areas.
Great work 👍
TejasAnalyst commentedon Feb 9, 2026
Hi, I have submitted a fix for this in PR #263.
The TypeError was happening because the tests were trying to do math on the method object itself instead of its return value.
I have updated the tests to use realistic static values (100kHz for SPI, 500kHz for UART), which resolves the crash on fresh install.
Please review PR #263.
saad-aids commentedon Mar 28, 2026
@pslab-python-maintainers Hi! Saad here (PR #282 - CTMU calibration contributor).
Claiming #257 for GSoC 2026 PSLab project. Reproducing locally now.
Fix plan: Auto-detect port in test fixture (serial.tools.list_ports).
PR Soon! Thanks! 🙏