forked from ptrlrd/threads-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix: the "Multiple Top-Level Modules" Error #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CodeIter
wants to merge
36
commits into
main
Choose a base branch
from
CodeIter-patch-5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Owner
CodeIter
commented
May 7, 2025
- Create empty src/init.py
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
./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.
84b7f95 to
2a7436b
Compare
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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.