Skip to content
Snippets Groups Projects
Commit 90252401 authored by Mayr, Hannes's avatar Mayr, Hannes
Browse files

Fix unittest for export_imports with versionnumbers.

parent 4c131762
Branches
Tags
2 merge requests!65Release v0.3.0,!64New year developments
Pipeline #888505 failed
......@@ -13,7 +13,7 @@ import os
import shutil
import sys
import warnings
from importlib.metadata import version
from importlib.metadata import version, PackageNotFoundError
from typing import TypedDict, Any
from plotid.save_plot import save_plot
from plotid.plotoptions import PlotIDTransfer, validate_list
......@@ -285,8 +285,11 @@ class Analyzer(ast.NodeVisitor):
# Write every item of the set to one line.
with open(output_file, "w", encoding="utf-8") as output:
for item in imports_as_set:
module_version = version(item)
output.write(f"{item}=={module_version}\n")
try:
module_version = version(item)
output.write(f"{item}=={module_version}\n")
except PackageNotFoundError:
output.write(f"{item}\n")
output.close()
......
......@@ -353,7 +353,7 @@ class TestPublish(unittest.TestCase):
"unittest\n",
"subprocess\n",
"platform\n",
"matplotlib\n",
"matplotlib==3.6.2\n",
"os\n",
"sys\n",
"plotid\n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment