Skip to content

Conversation

@HeroesDieYoung
Copy link
Collaborator

@HeroesDieYoung HeroesDieYoung commented Jun 3, 2025

  • Added pytest-isolate to fix test issues interfering with each other
  • Remove codium test files entirely
  • Commented out 7 remaining failing tests
  • Did not fix anything here, just removed failing tests

@HeroesDieYoung
Copy link
Collaborator Author

@rsnodgrass I got the dependencies fixed up and tests running, but a variety of them fail. Looking into it, it looks to me like tests aren't isolated and are interfering with each other.

For example, this test (from test_gateway.py):

# poll_interval property can be set to a custom value
def test_poll_interval_custom_value():
    """
    Test that poll_interval property can be set to a custom value
    """
    gateway = ADTPulseGateway()
    custom_interval = 10.0
    gateway.poll_interval = custom_interval
    assert gateway.poll_interval == custom_interval

sets that interval to 10, which does update the backoff class _initial_backoff_interval property. Then the very next test test_custom_values fails like this:

>       assert gateway.backoff._initial_backoff_interval == ADT_DEFAULT_POLL_INTERVAL
E       AssertionError: assert 10.0 == 2.0

and what do ya know, the value is still 10.0 instead of the default 2.0.

I'm not a python guy by any means, but I'm guessing it's one of:

  • pytest behavior change, did tests use to be isolated?
  • python behavior change, seems less likely, but what do I know. Since each test instantiates its own instance of the class I don't grok how they're interfering with each other.

@rsnodgrass
Copy link
Collaborator

rsnodgrass commented Jun 3, 2025

These tests seemed to largely be generated by CodiumAI last year, they may not be accurate and making assumptions during testing that may not be true as the code evolves.

AFAIK, the tests should be isolated.

Perhaps @rlippmann knows more.

@rlippmann
Copy link
Collaborator

Maybe a requirement that poetry has isn't in requirements.txt?

@EVWorth
Copy link
Contributor

EVWorth commented Jul 12, 2025

@HeroesDieYoung

Try rebasing... I refactored to use uv and the workflows are updated.

Tests are still failing but I'm curious to see if the same issues occur?

@EVWorth EVWorth self-requested a review July 12, 2025 17:21
@EVWorth EVWorth added the enhancement New feature or request label Jul 12, 2025
@HeroesDieYoung
Copy link
Collaborator Author

@HeroesDieYoung

Try rebasing... I refactored to use uv and the workflows are updated.

Tests are still failing but I'm curious to see if the same issues occur?

Updated, tests still seem to be failing the same way.

@EVWorth
Copy link
Contributor

EVWorth commented Jul 12, 2025

@rsnodgrass were these failing tests ever known good? or were they added and just never worked? is there a reason to keep them?

@HeroesDieYoung
Copy link
Collaborator Author

HeroesDieYoung commented Jul 12, 2025

@rsnodgrass were these failing tests ever known good? or were they added and just never worked? is there a reason to keep them?

This package isn't doing anyone any good at all right now, so IMO we're better off getting rid of them than continuing as-is. I get fewer test failures if I add pytest-isolate, I'm pushing that change now for you to take a look.

@EVWorth I've just removed all of the tests that were failing, I did not fix anything here. I remove the codium files entirely, they were full of failures, then just commented out the 7 remaining failing tests. We could merge this and give it a shot.

@HeroesDieYoung HeroesDieYoung marked this pull request as ready for review July 12, 2025 20:20
@EVWorth
Copy link
Contributor

EVWorth commented Jul 13, 2025

thanks @HeroesDieYoung!

a couple of questions and thoughts:

  1. what is the devcontainer.json used for?

  2. I noticed you still have the requirements.txt files, these can be removed now that we're using uv and pyproject.toml no?

  3. I noticed you downgraded some package versions, bumped some others, and installed multiple dev dependencies into the main dependency group.

can you speak to those dependency changes, uv remove [name] the dev packages you added to the main group and re-add them using uv add --dev [name]?
specific questions:

  • "aiohttp>=3.9.1", - why was the minimum version "downgraded" from 3.12.14?
  • "lxml>=5.1.0", - why was the minimum version "downgraded" from 6.0.0?
  • "aiohttp-zlib-ng>=0.1.1", - should be removed. replaced by aiohttp-fast-zlib[zlib-ng]
  • "pytest-isolate>=0.0.12", - should be removed and added --dev
  • "aioresponses>=0.7.3", - is already be in dev group, should be removed (uv remove [name])
  • "freezegun>=1.5.3", - is already be in dev group, should be removed (uv remove [name])
  • "pytest-asyncio>=1.0.0", - is already be in dev group, should be removed (uv remove [name])
  • "pytest-mock>=3.14.1", - is already be in dev group, should be removed (uv remove [name])
  • "typeguard>=4.1.5", - is already be in dev group, should be removed (uv remove [name])

@HeroesDieYoung
Copy link
Collaborator Author

@EVWorth full disclosure, I have no idea what I'm doing with Python - definitely not my language here. I've never used uv before, so thanks for the tips there. I think I have addressed everything you mentioned. TBH I didn't know what to make of the requirements files vs the toml file vs the UV manager (which appears to not have a user editable file at all and just wants you to interact via the CLI?).

As far as the devcontainers file, that's this feature of VSCode. I run within a Docker container that has exactly the environment I need for the project. That way I don't pollute my host with different versions of python, nodejs, global packages, etc etc. I've added it to .gitignore as a general safety. I don't think it's a terrible thing to have these committed to a repo, it would allow others to ensure they're developing in exactly the same environment as any other maintainers, but it's not necessary and it's not my repo so I've removed it.

@EVWorth
Copy link
Contributor

EVWorth commented Jul 13, 2025

So I think** in your devcontainer env, before you removed it ( 😃 ), I noticed you were running uv venv, uv run requirements.txt

all of that can be replaced completely with uv sync

uv sync will build a venv with the python version specified in pyproject.toml, and then install all dependencies configured in the uv.lock file. I think** that should work in your devcontainer as well. try replacing that line with just uv sync and let me know what happens (just curious)

Otherwise, commits look good and I see passing tests! woot! thanks for the contribution!

@EVWorth EVWorth merged commit a6b3077 into master Jul 13, 2025
4 checks passed
@HeroesDieYoung
Copy link
Collaborator Author

So I think** in your devcontainer env, before you removed it ( 😃 ), I noticed you were running uv venv, uv run requirements.txt

all of that can be replaced completely with uv sync

uv sync will build a venv with the python version specified in pyproject.toml, and then install all dependencies configured in the uv.lock file. I think** that should work in your devcontainer as well. try replacing that line with just uv sync and let me know what happens (just curious)

Otherwise, commits look good and I see passing tests! woot! thanks for the contribution!

Updated as you said, and bingo it does indeed behave exactly as you described. TIL a tiny bit about uv. Thanks!

@EVWorth
Copy link
Contributor

EVWorth commented Jul 13, 2025

@HeroesDieYoung also, I feel like I'm in the same boat. no idea what I'm doing and taking a lot of research to get things working. slowly learning more every day.. to two 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants