petermr / amiclimate

software and material for managing climate knowledge
Apache License 2.0
0 stars 0 forks source link

Error in running pytest #20

Open Smritiabcd opened 1 month ago

Smritiabcd commented 1 month ago

Git pull and git checkout test1_pmr successfully but then while running pytest, the following error has been coming up since past 2 days:

'''

C:\Users\asus\Desktop\Semantic\amiclimate> pytest ======================================================= test session starts ======================================================== platform win32 -- Python 3.12.3, pytest-8.2.0, pluggy-1.5.0 rootdir: C:\Users\asus\Desktop\Semantic\amiclimate collected 0 items / 1 error

============================================================== ERRORS ============================================================== ___ ERROR collecting test/testun.py ____ ImportError while importing test module 'C:\Users\asus\Desktop\Semantic\amiclimate\test\test_un.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ....\Internship\Lib\importlib\init__.py:90: in import_module return _bootstrap._gcd_import(name[level:], package, level) test\test_un.py:24: in from climate.amix import AMIClimate, REPO_DIR climate\amix.py:21: in from climate.ipcc import IPCCArgs climate\ipcc.py:14: in from amilib.util import AbstractArgs, Util E ImportError: cannot import name 'AbstractArgs' from 'amilib.util' (C:\Users\asus\Desktop\Internship\Lib\site-packages\amilib\util.py) ===================================================== short test summary info ====================================================== ERROR test/test_un.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ========================================================= 1 error in 7.83s =========================================================

petermr commented 1 month ago

Good report! Try updating amilib pip install amilib==0.1.5 or pip install amilib --upgrade

Smritiabcd commented 1 month ago

Good report! Try updating amilib pip install amilib==0.1.5 or pip install amilib --upgrade

Tried but still showing the same issue. Should i clone amilib and amiclimate again from scratch?

petermr commented 1 month ago

Have you got the latest amiclimate? My latest amiclimate/ipcc.py reads:

import argparse
import copy
import csv
import logging
import re
import textwrap
from abc import ABC, abstractmethod
from collections import defaultdict, Counter
from io import BytesIO
from pathlib import Path
import lxml.etree as ET
from lxml.html import HTMLParser
import pandas as pd
import requests
#
from amilib.ami_html import URLCache, HtmlUtil, H_DIV, H_A, HtmlStyle, A_NAME, A_CLASS, A_ID, A_STYLE, H_SPAN
from amilib.file_lib import FileLib
from amilib.util import Util
from amilib.ami_args import AbstractArgs <<<line 19 is different
from amilib.xml_lib import HtmlLib, XmlLib
cd amiclimate
git pull
git checkout test1_pmr