From b15cde271a76380ab2ba3dd2286c1ca0e53c3421 Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Fri, 22 Nov 2024 16:10:12 +0900 Subject: [PATCH] [tools/mec] Introduce noxfile This will introduce initial noxfile script for package generation and unit testing with nox. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- tools/model_explorer_circle/noxfile.py | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/model_explorer_circle/noxfile.py diff --git a/tools/model_explorer_circle/noxfile.py b/tools/model_explorer_circle/noxfile.py new file mode 100644 index 00000000000..3738621d64b --- /dev/null +++ b/tools/model_explorer_circle/noxfile.py @@ -0,0 +1,43 @@ +# Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import nox + +# Define the minimal nox version required to run +nox.options.needs_version = ">= 2024.3.2" + + +@nox.session +def build_and_check_dists(session): + session.install("build", "check-manifest >= 0.42", "twine", "ai-edge-model-explorer", + "flatbuffers") + + session.run("check-manifest", "--ignore", "noxfile.py,tests/**") + session.run("python", "-m", "build") + session.run("python", "-m", "twine", "check", "dist/*") + + +@nox.session(python=["3.10"]) +def tests(session): + session.install("pytest") + + build_and_check_dists(session) + + generated_files = os.listdir("dist/") + generated_sdist = os.path.join("dist/", generated_files[1]) + + session.install(generated_sdist) + + session.run("py.test", "tests/", *session.posargs)