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

[WIP] checklog-odoo improvements #2

Merged
merged 20 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
source =
checklog_odoo
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: CI

on:
push:
branches: ["main"]
tags: ["*"]
pull_request:

jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: ${{ matrix.machine }}
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.7"
machine: ubuntu-22.04
- python-version: "3.8"
machine: ubuntu-22.04
- python-version: "3.9"
machine: ubuntu-22.04
- python-version: "3.10"
machine: ubuntu-22.04
- python-version: "3.11"
machine: ubuntu-22.04
- python-version: "3.12"
machine: ubuntu-22.04
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
allow-prereleases: true
- name: "Install dependencies"
run: |
set -xe
python -VV
python -m site
python -m pip install --upgrade pip wheel
python -m pip install --upgrade tox tox-gh-actions
- name: "Run tox targets for ${{ matrix.python-version }}"
run: |
python -m tox
- uses: codecov/codecov-action@v3
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ cover/
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion checklog-odoo/LICENSE.txt → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023-present Benoit Aimont <benoit.aimont@acsone.eu>
Copyright (c) 2023-present ACSONE SA/NV
baimont marked this conversation as resolved.
Show resolved Hide resolved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
# checklog-odoo

[![PyPI - Version](https://img.shields.io/pypi/v/checklog-odoo.svg)](https://pypi.org/project/checklog-odoo)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/checklog-odoo.svg)](https://pypi.org/project/checklog-odoo)

-----

<!--- shortdesc-begin -->

Check if an odoo log file contains error, with the possibility to ignore some errors based on regular expressions.
Replaces acsoo checklog (https://github.com/acsone/acsoo#id5).

<!--- shortdesc-end -->

**Table of Contents**

- [Installation](#installation)
- [Features](#features)
- [License](#license)

## Installation

```console
pip install checklog-odoo
baimont marked this conversation as resolved.
Show resolved Hide resolved
```

## Features

```console
checklog-odoo odoo.log
unbuffer odoo -d mydb -i base --stop-after-init | checklog-odoo
checklog-odoo --ignore "WARNING.*blah" odoo.log
```
baimont marked this conversation as resolved.
Show resolved Hide resolved

## License

`checklog-odoo` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
21 changes: 0 additions & 21 deletions checklog-odoo/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions checklog-odoo/src/checklog_odoo/__about__.py

This file was deleted.

3 changes: 0 additions & 3 deletions checklog-odoo/src/checklog_odoo/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions checklog-odoo/src/checklog_odoo/__main__.py

This file was deleted.

6 changes: 0 additions & 6 deletions checklog-odoo/src/checklog_odoo/cli/__init__.py

This file was deleted.

3 changes: 0 additions & 3 deletions checklog-odoo/tests/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion checklog-odoo/tests/data/odoo/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion checklog-odoo/tests/data/odoo/addons/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions checklog-odoo/tests/data/odoo/addons/addon1/__manifest__.py

This file was deleted.

Empty file.
2 changes: 0 additions & 2 deletions checklog-odoo/tests/data/odoo/addons/addon2/__manifest__.py

This file was deleted.

70 changes: 0 additions & 70 deletions checklog-odoo/tests/test_checklog.py

This file was deleted.

35 changes: 17 additions & 18 deletions checklog-odoo/pyproject.toml → pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "checklog-odoo"
dynamic = ["version"]
description = ''
description = 'Check if an odoo log file contains error, with the possibility to ignore some errors based on regular expressions'
readme = "README.md"
requires-python = ">=3.7"
license = "MIT"
Expand Down Expand Up @@ -35,16 +35,21 @@ Issues = "https://github.com/unknown/checklog-odoo/issues"
Source = "https://github.com/unknown/checklog-odoo"

[project.scripts]
checklog-odoo = "checklog_odoo.cli.checklog:checklog_odoo"
checklog-odoo = "checklog_odoo.checklog:checklog_odoo"

[tool.hatch.version]
path = "src/checklog_odoo/__about__.py"
source = "vcs"

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
dependencies = []

[project.optional-dependencies]
metadata = []
test = [
"pytest",
"coverage[toml]",
]

[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
Expand All @@ -68,7 +73,7 @@ dependencies = [
"ruff>=0.0.243",
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:src/checklog_odoo tests}"
typing = "mypy --install-types --non-interactive {args:checklog_odoo tests}"
style = [
"ruff {args:.}",
"black --check --diff {args:.}",
Expand Down Expand Up @@ -144,20 +149,14 @@ ban-relative-imports = "all"
"tests/**/*" = ["PLR2004", "S101", "TID252"]

[tool.coverage.run]
source_pkgs = ["checklog_odoo", "tests"]
branch = true
parallel = true
omit = [
"src/checklog_odoo/__about__.py",
]
source_pkgs = ["checklog-odoo"]

[tool.coverage.paths]
checklog_odoo = ["src/checklog_odoo", "*/checklog-odoo/src/checklog_odoo"]
tests = ["tests", "*/checklog-odoo/tests"]
source = ["src", ".tox/*/site-packages"]
baimont marked this conversation as resolved.
Show resolved Hide resolved

[tool.coverage.report]
show_missing = true
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"pragma: no cover",
]
5 changes: 5 additions & 0 deletions src/checklog_odoo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023-present ACSONE <https://acsone.eu>
#
# SPDX-License-Identifier: MIT

from . import checklog
baimont marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions src/checklog_odoo/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2023-present ACSONE <https://acsone.eu>
#
# SPDX-License-Identifier: MIT
import sys

if __name__ == "__main__":
from checklog_odoo.checklog import checklog_odoo

sys.exit(checklog_odoo())
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# SPDX-FileCopyrightText: 2023-present Benoit Aimont <benoit.aimont@acsone.eu>
# SPDX-FileCopyrightText: 2023-present ACSONE <https://acsone.eu>
#
# SPDX-License-Identifier: MIT

from checklog_odoo.__about__ import __version__

import logging
import re
import sys
Expand Down Expand Up @@ -118,7 +116,6 @@ def format(self, record):
help="Check an odoo log file for errors. When no filename "
"or - is provided, read from stdin."
)
@click.version_option(version=__version__, prog_name="checklog-odoo")
@click.option(
"--ignore",
"-i",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Benoit Aimont <benoit.aimont@acsone.eu>
# SPDX-FileCopyrightText: 2023-present ACSONE <https://acsone.eu>
#
# SPDX-License-Identifier: MIT

Expand Down
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2023-present ACSONE <https://acsone.eu>
#
# SPDX-License-Identifier: MIT
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions tests/data/test1.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
2017-05-21 14:01:49,686 8038 INFO ? odoo: Odoo version 10.0
2017-05-21 14:01:49,687 8038 INFO ? odoo: addons paths: [u'/home/nobody/odoo-10.0/addons', u'/home/nobody/odoo/odoo/addons', u'/home/nobody/odoo/src/odoo10-addon-mail-environment/setup/mail_environment/odoo/addons', u'/home/nobody/odoo/src/odoo10-addon-mis-builder/setup/mis_builder/odoo/addons', u'/home/nobody/odoo/src/odoo10-addon-mis-builder-operating-unit/setup/mis_builder_operating_unit/odoo/addons', u'/home/nobody/odoo/src/odoo10-addon-server-environment-ir-config-parameter/setup/server_environment_ir_config_parameter/odoo/addons', u'/home/nobody/.virtualenvs/odoo-bscw/local/lib/python2.7/site-packages/odoo/addons', u'/home/nobody/.virtualenvs/odoo-bscw/lib/python2.7/site-packages/odoo/addons', '/home/nobody/odoo/src/odoo/odoo/addons']
2017-05-21 14:01:49,687 8038 INFO ? odoo: database: default@default:default
2017-05-21 14:01:50,496 8038 INFO ? odoo.modules.loading: init db
2017-05-21 14:01:50,637 8038 ERROR ? odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
...
OSError: [Errno 2] No such file or directory: '/home/nobody/odoo-10.0/addons'
2017-05-21 14:01:50,637 8038 CRITICAL ? odoo.service.server: Failed to initialize database `odoo-bscw-testsuite-1`.
Traceback (most recent call last):
...
2017-05-21 14:01:50,638 8038 INFO ? odoo.service.server: Initiating shutdown
2017-05-21 14:01:50,638 8038 INFO ? odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
Loading