Skip to content
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

Feature/pytest #29

Merged
merged 5 commits into from
Jun 13, 2024
Merged

Feature/pytest #29

merged 5 commits into from
Jun 13, 2024

Conversation

nakamori1024
Copy link
Contributor

@nakamori1024 nakamori1024 commented Mar 7, 2024

変更内容:Description

その他:Notes

確認手順

以下の手順で、pytestが実行できることをご確認ください。

  • QGIS内のpythonを基にpoetry環境を構築する
    poetry env use /Applications/QGIS-LTR.app/Contents/MacOS/bin/python3
    poetry install
    
  • pytestを実行する
    poetry run pytest
    
  • pytestが実行されることを確認する(pyprojが読み込めないwarningは発生しますが、そこまでは対応してないです)

Summary by CodeRabbit

  • 新機能

    • ユーザーのロケール設定に基づいて、地図キャンバス内のタイルを取得する機能が改善されました。設定がない場合はデフォルトで英語が選択されます。
  • バグ修正

    • モジュールのインポート方法が更新され、クラスのインポートが改善されました。
  • テスト

    • 新しいテスト設定として、QGISプラグインの初期化を行うフィクスチャが追加されました。
    • ダイアログが正しく表示されるかどうかを確認するテスト機能が追加されました。
  • リファクタ

    • コードカバレッジテストの設定が追加され、testsディレクトリ下のファイルが除外されるようになりました。
    • 一部のインポート文が絶対インポートに変更され、モジュールへのアクセス方法が改善されました。

@nakamori1024 nakamori1024 added the enhancement New feature or request label Mar 7, 2024
@nakamori1024 nakamori1024 self-assigned this Mar 7, 2024
Copy link

coderabbitai bot commented Mar 7, 2024

Walkthrough

この変更の概要は、テストカバレッジの設定、モジュールインポート方法の調整、ロケールに基づく条件分岐の追加、絶対インポートへの変更、そしてQGISプラグインのテスト機能の導入に関わるものです。これらはコードの保守性とテストのしやすさを向上させることを目的としています。

Changes

ファイル 変更概要
.coveragerc テストディレクトリ下のファイルを除外するカバレッジテストの設定を導入
__init__.py モジュールのインポート方法を変更し、親ディレクトリをPythonパスに追加
elevation_tile_for_jp.py GetTilesWithinMapCanvasのインポート文を変更し、ユーザーロケール設定に基づいてlocale変数を設定する条件分岐を追加
get_tiles.py ElevationTileforJPDialogElevationTileConverterのインポートを絶対インポートに変更
tests/conftest.py, tests/test_dialog.py QGISプラグインのテスト機能を導入するための新しいテストファイル

🐰✨
コードの森を駆け巡る小さな僕
変更の風、新たな道を切り開く
テストの光、バグの影を追い払う
今日もまた、進化の一歩を踏み出す
🌟🌿

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6a65d71 and ec091bd.
Files ignored due to path filters (3)
  • poetry.lock is excluded by: !**/*.lock
  • poetry.toml is excluded by: !**/*.toml
  • pyproject.toml is excluded by: !**/*.toml
Files selected for processing (6)
  • .coveragerc (1 hunks)
  • init.py (2 hunks)
  • elevation_tile_for_jp.py (2 hunks)
  • get_tiles.py (1 hunks)
  • tests/conftest.py (1 hunks)
  • tests/test_dialog.py (1 hunks)
Additional comments: 6
.coveragerc (1)
  • 1-3: カバレッジ設定において、テストコードをカバレッジ計算から除外する設定が適切に追加されています。この変更はプロジェクトのカバレッジ計測をより実用的なものにします。
tests/test_dialog.py (1)
  • 1-9: ElevationTileForJPプラグインのダイアログ表示機能をテストする新しいテストケースが適切に追加されています。テストは明確で、プラグインの機能を適切に検証しています。
tests/conftest.py (1)
  • 1-17: pytestのフィクスチャが適切に定義されており、テストの前処理と後処理を効率的に行うことができます。ただし、_plugin.unload()がコメントアウトされている部分については、将来的にpytest-qgisがこの機能をサポートした際に、リソースの解放を忘れないように注意が必要です。
__init__.py (1)
  • 20-29: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [23-35]

モジュールのインポート方法に関する変更が行われています。親ディレクトリをPythonパスに追加することで、モジュールのインポートが可能になっています。この方法は特定の状況で有効ですが、将来的なメンテナンスの観点から、依存関係の解決にはより適切な方法を検討することをお勧めします。

elevation_tile_for_jp.py (1)
  • 37-48: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [30-45]

GetTilesWithinMapCanvasのインポート方法の変更と、ユーザーロケール設定に基づくlocale変数の設定に関する変更が適切に行われています。これらの変更は、プロジェクトの構造変更に対応し、異なる環境でのテストの柔軟性を高めるために有効です。

get_tiles.py (1)
  • 31-34: ElevationTileforJPDialogElevationTileConverterのインポート方法が絶対インポートに変更されています。この変更は、プロジェクトの構造変更に対応し、モジュールのロードの信頼性を高めるために有効です。

@nokonoko1203 nokonoko1203 self-requested a review March 8, 2024 05:45
@bordoray
Copy link

@nakamori1024 Thanks for enhance!
Reviewerが動作確認できるために手順をはっきり記入お願いします!

@bordoray
Copy link

Test

@nokonoko1203 nokonoko1203 removed their request for review June 11, 2024 13:48
Copy link

@bordoray bordoray left a comment

Choose a reason for hiding this comment

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

Succeed !
image

@bordoray bordoray merged commit 1b66ce7 into master Jun 13, 2024
2 checks passed
@bordoray bordoray deleted the feature/pytest branch June 13, 2024 01:57
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.

2 participants