Repository navigation
Conversation
Signed-off-by: Payalrvs0310@gmail.com <Payalrvs0310@gmail.com>
❌ Deploy Preview for bibliodrift-dm failed. Why did it fail? →
|
mayank-dev-15
left a comment
There was a problem hiding this comment.
Good fix - repairing ignored test files ensures test coverage is maintained. LGTM.
RudraMalvankar
left a comment
There was a problem hiding this comment.
Thanks for working on re-enabling the previously ignored test suites.
The overall direction looks good and the added test coverage is valuable. I left a comment regarding the cache initialization path in cache_service.py, as it may lead to self.cache being unset when flask-caching is unavailable.
Other than that, the test cleanup and CI updates look reasonable.
| cache_config['CACHE_TYPE'] = 'SimpleCache' | ||
| logger.info("Using simple in-memory cache (not recommended for production)") | ||
|
|
||
| if Cache is None: |
There was a problem hiding this comment.
Returning early here leaves self.cache unset. Downstream code that assumes self.cache exists may raise an AttributeError. Would it be safer to initialize a fallback cache implementation or explicitly set self.cache = None before returning?
|
@RudraMalvankar, Thanks for looking closely! |
Description
Repairs all 5 test files that were silently ignored in CI, as reported in #804. Each fix targets the root cause rather than patching symptoms.
Changes made
backend/requirements.txtbeautifulsoup4,flask-caching,vaderSentimentbackend/cache_service.pyCache = Nonefallback and early-return guard so caching degrades gracefully when flask-caching is absenttests/conftest.pymagic,spine_generator,vaderSentiment,vaderSentiment.vaderSentiment,nltk.corpusso tests run on Windows and without optional native librariestests/test_purchase_links.pyfrom app import appand localclientfixture that caused a double-import ofbackend/app.py, producing a broken second Flask instance and 404 responses; now uses conftest's properly-initialised clienttests/test_env_validation.pyos.environ.clear()+ manual restore pattern withmonkeypatch.setenv/delenvandmonkeypatch.delitem(sys.modules, 'config')for proper per-test isolationtests/test_llm.pyTestIsAvailable,TestGenerateText, andTestLLMServiceSingletonclasses using mocks.github/workflows/ci.ymlflask-cachingto install step; removed 5--ignoreflags so all repaired tests run in CIRoot causes fixed
beautifulsoup4andvaderSentimentinstalled ad-hoc in CI but missing fromrequirements.txtredisandflask_cachingwere in the sametryblock -import redisfailing meantCachewas never defined, disabling caching entirely and breaking cache-hit assertionsfrom app import appat module level created a second Flask instance (sys.modules['app']vssys.modules['backend.app']), corrupting SQLAlchemy state → 404os.environ.clear()wiped system env vars mid-test; nosys.modulesisolation between tests leaked stale config stateprint()statements - not a pytest test at allRelated Issue
Fixes #804
Type of Change
Testing
Ran full test suite locally: