Skip to content

Commit 2f2ba0f

Browse files
committed
[FIX] deprectation for tests.common.Form + tests OLS03301 and 2
1 parent 87ddc04 commit 2f2ba0f

File tree

7 files changed

+47
-3
lines changed

7 files changed

+47
-3
lines changed

server/src/core/symbols/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@ impl Symbol {
25832583
fn member_symbol_hook(&self, session: &SessionInfo, name: &String, diagnostics: &mut Vec<Diagnostic>){
25842584
if session.sync_odoo.version_major >= 17 && name == "Form"{
25852585
let tree = self.get_tree();
2586-
if tree == (vec![Sy!("odoo"), Sy!("tests"), Sy!("common")], vec!()) {
2586+
if tree.0.ends_with(&[Sy!("odoo"), Sy!("tests"), Sy!("common")]) && tree.1.is_empty() {
25872587
if let Some(diagnostic_base) = create_diagnostic(session, DiagnosticCode::OLS03301, &[]) {
25882588
diagnostics.push(
25892589
Diagnostic {

server/tests/data/addons/module_2/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
'installable': True,
1616
'application': True,
1717
'license': 'LGPL-3',
18+
'active': True, # OLS03302
1819
}

server/tests/data/addons/module_2/models/base_test_models.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
from odoo import api, fields, models, _, tools
2+
from odoo.tests.common import Form # OLS03301
3+
from odoo.tests import common
4+
25
class BaseTestModel(models.Model):
36
_inherit = "pygls.tests.base_test_model"
47
test_int = fields.Integer(compute="_compute_something")
@@ -14,4 +17,10 @@ class Module2CustomModel(models.Model):
1417
diag_id = fields.Many2one("module_1.diagnostics_model")
1518

1619
class TestEmptyModel(models.Model):
17-
_name = "module_2.empty_model"
20+
_name = "module_2.empty_model"
21+
22+
23+
class A(common.Form): # OLS01001, OLS03301
24+
25+
def test(self):
26+
Form = common.Form # OLS03301

server/tests/diagnostics/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ pub mod ols01010;
1313
pub mod ols02001;
1414
pub mod ols02002;
1515
pub mod ols03000_1_to_23;
16+
pub mod ols03301;
17+
pub mod ols03302;
1618
pub mod ols0500_00_12;

server/tests/diagnostics/ols03000_1_to_23.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use odoo_ls_server::utils::PathSanitizer;
55
use crate::{setup::setup::*, test_utils::{verify_diagnostics_against_doc}};
66

77
#[test]
8-
fn test_ols03001() {
8+
fn test_ols03001_23() {
99
// Setup server and session with test addons
1010
let (mut odoo, config) = setup_server(true);
1111
let mut session = create_init_session(&mut odoo, config);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use std::env;
2+
3+
use odoo_ls_server::utils::PathSanitizer;
4+
5+
use crate::{setup::setup::*, test_utils::{verify_diagnostics_against_doc}};
6+
7+
#[test]
8+
fn test_ols03301() {
9+
// Setup server and session with test addons
10+
let (mut odoo, config) = setup_server(true);
11+
let mut session = create_init_session(&mut odoo, config);
12+
let path = env::current_dir().unwrap().join("tests/data/addons/module_2/models/base_test_models.py").sanitize();
13+
let diagnostics = get_diagnostics_for_path(&mut session, &path);
14+
let doc_diags = get_diagnostics_test_comments(&mut session, &path);
15+
verify_diagnostics_against_doc(diagnostics, doc_diags);
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use std::env;
2+
3+
use odoo_ls_server::utils::PathSanitizer;
4+
5+
use crate::{setup::setup::*, test_utils::{verify_diagnostics_against_doc}};
6+
7+
#[test]
8+
fn test_ols03302() {
9+
// Setup server and session with test addons
10+
let (mut odoo, config) = setup_server(true);
11+
let mut session = create_init_session(&mut odoo, config);
12+
let path = env::current_dir().unwrap().join("tests/data/addons/module_2/__manifest__.py").sanitize();
13+
let diagnostics = get_diagnostics_for_path(&mut session, &path);
14+
let doc_diags = get_diagnostics_test_comments(&mut session, &path);
15+
verify_diagnostics_against_doc(diagnostics, doc_diags);
16+
}

0 commit comments

Comments
 (0)