generated from casework/CASE-Implementation-Template-Python-CLI
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Cyber-Domain-Ontology/test_relative_call_p…
…ositions Test relative call positions
- Loading branch information
Showing
41 changed files
with
1,100 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
These tests confirm the impact, and mostly non-impact, of the following factors in usage of `cdo-local-uuid`: | ||
|
||
* Whether a project's top source directory has an effect on the UUID seeding (e.g. via indepenent Git clones). | ||
- See `varying_top_srcdir/`. | ||
* Whether the called program is installed in a virtual environment, or a standalone script. | ||
- See `relativity_to_venv/editability_*/cdo_example_command/__init__.py` for the former. | ||
- See `varying_top_srcdir/project_*/example.py` for the latter. | ||
* Whether the virtual environment being in the same directory, or not, has an effect on the UUID seeding. | ||
- See `relativity_to_venv/editability_*/dir_1/Makefile` for call examples. | ||
|
||
`pytest` scripts confirm when various factors are expected to influence and not influence the UUID seeding. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/make -f | ||
|
||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
SHELL := /bin/bash | ||
|
||
top_srcdir := $(shell cd ../.. ; pwd) | ||
|
||
PYTHON3 ?= python3 | ||
|
||
all: \ | ||
all-editability_no \ | ||
all-editability_yes | ||
|
||
all-editability_no: | ||
$(MAKE) \ | ||
--directory editability_no | ||
|
||
all-editability_yes: | ||
$(MAKE) \ | ||
--directory editability_yes | ||
|
||
check: \ | ||
all | ||
|
||
check: \ | ||
all | ||
source $(top_srcdir)/tests/venv/bin/activate \ | ||
&& pytest \ | ||
--log-level=DEBUG \ | ||
--verbose \ | ||
test_outputs.py | ||
|
||
clean: \ | ||
clean-editability_no \ | ||
clean-editability_yes | ||
|
||
clean-editability_no: | ||
@$(MAKE) \ | ||
--directory editability_no \ | ||
clean | ||
|
||
clean-editability_yes: | ||
@$(MAKE) \ | ||
--directory editability_yes \ | ||
clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Tests: Virtual environment editability | ||
|
||
This directory confirms the editability of a project installed into a virtual environment does not influence programs in the top directory, nor below the top directory. The Python test in this directory confirms generated UUIDs match only when they're expected to, and mismatch in expected cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/make -f | ||
|
||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
installation_editable := no | ||
|
||
include ../editability_x.mk |
29 changes: 29 additions & 0 deletions
29
tests/relativity_to_venv/editability_no/cdo_example_command/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
import logging | ||
|
||
import cdo_local_uuid | ||
|
||
|
||
def main() -> None: | ||
logging.basicConfig(level=logging.DEBUG) | ||
cdo_local_uuid.configure() | ||
print(cdo_local_uuid.local_uuid()) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
16 changes: 16 additions & 0 deletions
16
tests/relativity_to_venv/editability_no/cdo_example_command/py.typed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
# This file is defined to support PEP 561: | ||
# https://www.python.org/dev/peps/pep-0561/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/make -f | ||
|
||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
include ../../editability_x_dir_1.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[metadata] | ||
name = cdo-example-command | ||
version = 0.0.1 | ||
author = Example Developer | ||
author_email = [email protected] | ||
description = Test project | ||
classifiers = | ||
Development Status :: 1 - Planning | ||
Operating System :: OS Independent | ||
Private :: Do Not Upload | ||
Programming Language :: Python :: 3 | ||
# Usage of the classifier 'Private :: Do Not Upload' is to confirm that | ||
# the package configuration for cdo-local-uuid is ignoring this test | ||
# project. If it's picked up, PyPI will reject the package, per: | ||
# https://pypi.org/classifiers/ | ||
|
||
[options] | ||
include_package_data = true | ||
packages = find: | ||
install_requires = | ||
cdo_local_uuid | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
cdo_example_command = cdo_example_command:main | ||
|
||
[options.package_data] | ||
cdo_example_command = py.typed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
import setuptools | ||
|
||
if __name__ == "__main__": | ||
setuptools.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/usr/bin/make -f | ||
|
||
# Portions of this file contributed by NIST are governed by the | ||
# following statement: | ||
# | ||
# This software was developed at the National Institute of Standards | ||
# and Technology by employees of the Federal Government in the course | ||
# of their official duties. Pursuant to Title 17 Section 105 of the | ||
# United States Code, this software is not subject to copyright | ||
# protection within the United States. NIST assumes no responsibility | ||
# whatsoever for its use by other parties, and makes no guarantees, | ||
# expressed or implied, about its quality, reliability, or any other | ||
# characteristic. | ||
# | ||
# We would appreciate acknowledgement if the software is used. | ||
|
||
# Purpose: | ||
# | ||
# This Makefile is intended to be loaded with the 'include' Make | ||
# directive in one of the editability_*/Makefile files. The variable | ||
# installation_editable is expected to be 'yes' or 'no'. | ||
# https://www.gnu.org/software/make/manual/html_node/Include.html | ||
# | ||
# This file is not intended to be used with Make by itself. | ||
# | ||
# This Makefile confirms that the same command line generates the same | ||
# UUID sequence, and clarifies that redirection of stdout to a differing | ||
# file path is not considered as part of the sequence seed. It also | ||
# recurses into dir_1/ to test different relative positions (pwd, or | ||
# pwd's parent) for CDO_DEMO_NONRANDOM_UUID_BASE. | ||
|
||
SHELL := /bin/bash | ||
|
||
# NOTE: This top_srcdir is the "real" top source directory, the root | ||
# directory of the cdo-local-uuid repository, for access to the | ||
# cdo_local_uuid project as a local directory. | ||
top_srcdir := $(shell cd ../../.. ; pwd) | ||
|
||
PYTHON3 ?= python3 | ||
|
||
ifeq ($(installation_editable),) | ||
$(error installation_editable undefined ; please define before the Make 'include' directive) | ||
endif | ||
ifeq ($(installation_editable),yes) | ||
editable_flag=--editable | ||
else | ||
editable_flag= | ||
endif | ||
|
||
all: \ | ||
all-dir_1 \ | ||
output_0.txt \ | ||
output_1.txt | ||
|
||
%.txt: \ | ||
.venv.done.log \ | ||
cdo_example_command/__init__.py | ||
export CDO_DEMO_NONRANDOM_UUID_BASE="$$(pwd)" \ | ||
&& source venv/bin/activate \ | ||
&& cdo_example_command \ | ||
> _$@ | ||
mv _$@ $@ | ||
|
||
.venv.done.log: \ | ||
$(top_srcdir)/setup.cfg \ | ||
$(top_srcdir)/setup.py \ | ||
setup.cfg \ | ||
setup.py | ||
rm -rf venv | ||
$(PYTHON3) -m venv \ | ||
venv | ||
source venv/bin/activate \ | ||
&& pip install \ | ||
--upgrade \ | ||
pip \ | ||
setuptools \ | ||
wheel | ||
source venv/bin/activate \ | ||
&& pip install \ | ||
$(top_srcdir) | ||
source venv/bin/activate \ | ||
&& pip install \ | ||
$(editable_flag) \ | ||
. | ||
touch $@ | ||
|
||
all-dir_1: \ | ||
.venv.done.log | ||
$(MAKE) \ | ||
--directory dir_1 | ||
|
||
check: \ | ||
all | ||
|
||
clean: | ||
@rm -f \ | ||
.venv.done.log \ | ||
*.txt | ||
@rm -rf \ | ||
venv |
Oops, something went wrong.