Skip to content

Conversation

@CodeIter
Copy link
Owner

@CodeIter CodeIter commented May 7, 2025

  • Create empty src/init.py

CodeIter added 30 commits May 7, 2025 16:57
Add empty line between pip module and local src module
Add empty line between pip module and local src module
Added import os and défaut empty string value.
- Reorder import.
- Import access token and draft file from src/env.py .
- Load new empty draft file from xdg cache dir if not exist or from user env DRAFTS_FILE if exist.
- if user draft file is filename and not exist , use the user name from xdg cache dir as new file.
Load DRAFTS_FILE env default to 'drafts.json'
Fix typo
With access token and draft file env.
Explain draft file env logic
Add BASE_URL to env example
Import app variable from src/app.py
Reorder import.
Load app from src/app.py.
Add commented Alternative Method to Modify sys.path for importing app from main.py , non ideal, when tests rely on running the application entry point.
# Ensure DRAFTS_FILE path is resolved and the file exists, following XDG Base Directory Specification if necessary
Implement unique test drafts file generation
Update comments of ACCESS_TOKEN and BASE_URL
Remove import app duplicate line
Fix typo in comment : TEST_DRAFTS_FILE instead of DRAFTS_FILE
CodeIter added 4 commits May 8, 2025 06:34
./tests/test_main.py:30:20: F821 undefined name 'ensure_drafts_file'
TEST_DRAFTS_FILE = ensure_drafts_file(TEST_DRAFTS_FILE)
                   ^
1     F821 undefined name 'ensure_drafts_file'
Added tests/conftest.py to prepend the project root to sys.path, ensuring that the src package is discoverable during test runs.
Removed the warning comment regarding changing the import path at runtime, as tests/conftest.py now handles PYTHONPATH adjustments.
Modified the Test with pytest workflow step to include the ACCESS_TOKEN environment variable from secrets.
@CodeIter CodeIter self-assigned this May 8, 2025
@CodeIter CodeIter added bug Something isn't working enhancement New feature or request labels May 8, 2025
@CodeIter CodeIter force-pushed the CodeIter-patch-5 branch 2 times, most recently from 84b7f95 to 2a7436b Compare May 9, 2025 04:33
CodeIter added 2 commits May 9, 2025 05:54
Comment default ACCESS_TOKEN to not override environment variables
Resolved AttributeError in test_main.py by updating mock.patch targets to use the correct module path (src.app.* instead of main.*).
This ensures that create_post and create_text_post are properly mocked during CLI command tests.

* modified:   tests/test_main.py

Signed-off-by: Muhammad Amin Boubaker <muhammadaminboubaker@gmail.com>
@CodeIter CodeIter force-pushed the CodeIter-patch-5 branch from 2a7436b to 9b80a3c Compare May 9, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants