Skip to content

T351642: Discard canary events in Hashtags - #93

Merged
jsnshrmn merged 1 commit into
masterfrom
theresnotime/T351642
Oct 14, 2026
Merged

jsnshrmn merged 1 commit into
masterfrom
theresnotime/T351642

Conversation

@theresnotime

Copy link
Copy Markdown
Member

Discard canary events in Hashtags

Bug: T351642

@jsnshrmn jsnshrmn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does what it says on the tin; suggest sorting out ci for scripts dir tests separately, but this works for now.

Comment thread scripts/test_common.py
@@ -0,0 +1,18 @@
import unittest

from common import is_canary

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to do some research, but it looks like if we add an empty __init__.py to the scripts/ directory, it will then be treated as a Python package and Django will look for the tests. However because the tests are ran from the root directory, it will think common is a top-level package when it's only part of scripts. The fix there seems to be to add a parent-relative import:

Suggested change
from common import is_canary
from .common import is_canary

Then docker compose exec app python manage.py test (and CI) should run the test. I think however the other files in scripts/ need the same treatment to import locally, which doesn't look a huge change:

  • collect_hashtags.py – from common → from .common, import db → import .db
  • load_old_db.py – from common → from .common

Should we go ahead and try that?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note again I'm not very experienced with Python so this may not be the right way to go about it. If there's any disagreement, I'm happy to defer to @jsnshrmn and sort out running the tests in a separate PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The collector is started directly as python collect_hashtags.py, so Python doesn't treat it as part of a package, and from .common import ... only works inside a package so things would break if we did that :) getting the test working isn't a big change but might be worth following up with instead I think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; let's merge for now and consider this a coverage concern for future ci work.

@jsnshrmn
jsnshrmn merged commit cd34e4d into master Oct 14, 2026
1 check passed
@MusikAnimal
MusikAnimal deleted the theresnotime/T351642 branch October 14, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants