From 5070f94fdcdeed450a4b80e005832e8a7f83b01e Mon Sep 17 00:00:00 2001 From: Daniel Wheeler Date: Thu, 5 May 2022 13:45:45 -0400 Subject: [PATCH 1/4] test: fix for missing coverage --- _data/python-pfhub/pfhub/conftest.py | 27 ++++++++++++++++++++++----- _data/python-pfhub/pfhub/main.py | 2 ++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/_data/python-pfhub/pfhub/conftest.py b/_data/python-pfhub/pfhub/conftest.py index 25dd00c85..e29cbb8c3 100644 --- a/_data/python-pfhub/pfhub/conftest.py +++ b/_data/python-pfhub/pfhub/conftest.py @@ -5,7 +5,7 @@ import yaml -def make_yaml_content(id_, version): +def make_yaml_content(id_, version, name=None): """Generate some test yaml content Args: @@ -15,7 +15,7 @@ def make_yaml_content(id_, version): Returns: yaml result content as string """ - return f""" + data = f""" --- benchmark: id: {id_} @@ -45,9 +45,11 @@ def make_yaml_content(id_, version): expr: datum.y * 2 as: b """ + if name is not None: + data = data + f'\nname: {name}' + return data - -def make_yaml(dir_, name, id_, version): +def make_yaml(dir_, name, id_, version, add_name=False): """Generate a yaml file for test purposes Args: @@ -55,6 +57,7 @@ def make_yaml(dir_, name, id_, version): name: name of the result id_: the benchmark id_ (e.g. "8a") version: the version (e.g. "1") + name: the name of the simulation (e.g. "fipy1a") Returns: name of the file created @@ -62,7 +65,7 @@ def make_yaml(dir_, name, id_, version): dir_name = dir_ / name dir_name.mkdir(exist_ok=True) yaml_file = dir_name / "meta.yaml" - yaml_file.write_text(make_yaml_content(id_, version)) + yaml_file.write_text(make_yaml_content(id_, version, name=name if add_name else None)) return yaml_file @@ -80,6 +83,20 @@ def yaml_data_file(tmp_path): return make_yaml(tmp_path, "result", "1a", 1) +@pytest.fixture +def yaml_data_file_with_name(tmp_path): + """Generate a yaml test file with name included + + Args: + tmp_path: temporary area to use to write files + + Returns: + name of the data file + """ + tmp_path.mkdir(exist_ok=True) + return make_yaml(tmp_path, "result1", "1a", 1, add_name=True) + + @pytest.fixture def test_data_path(tmp_path): """Generate two result data files diff --git a/_data/python-pfhub/pfhub/main.py b/_data/python-pfhub/pfhub/main.py index 9c65def23..c46ddc840 100644 --- a/_data/python-pfhub/pfhub/main.py +++ b/_data/python-pfhub/pfhub/main.py @@ -103,6 +103,8 @@ def read_add_name(yaml_url): >>> assert read_add_name(getfixture('yaml_data_file').as_uri())['name'] == 'result' + >>> assert read_add_name(getfixture('yaml_data_file_with_name').as_uri())['name'] == 'result1' + """ data = read_yaml_from_url(yaml_url) if 'name' in data: From 30bf1150629aadb7864f82fe05a205c37ed18d6b Mon Sep 17 00:00:00 2001 From: Daniel Wheeler Date: Thu, 5 May 2022 16:11:21 -0400 Subject: [PATCH 2/4] style: fix for black --- _data/python-pfhub/pfhub/conftest.py | 7 +++++-- _data/python-pfhub/pfhub/main.py | 25 ++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/_data/python-pfhub/pfhub/conftest.py b/_data/python-pfhub/pfhub/conftest.py index e29cbb8c3..3b978ad56 100644 --- a/_data/python-pfhub/pfhub/conftest.py +++ b/_data/python-pfhub/pfhub/conftest.py @@ -46,9 +46,10 @@ def make_yaml_content(id_, version, name=None): as: b """ if name is not None: - data = data + f'\nname: {name}' + data = data + f"\nname: {name}" return data + def make_yaml(dir_, name, id_, version, add_name=False): """Generate a yaml file for test purposes @@ -65,7 +66,9 @@ def make_yaml(dir_, name, id_, version, add_name=False): dir_name = dir_ / name dir_name.mkdir(exist_ok=True) yaml_file = dir_name / "meta.yaml" - yaml_file.write_text(make_yaml_content(id_, version, name=name if add_name else None)) + yaml_file.write_text( + make_yaml_content(id_, version, name=name if add_name else None) + ) return yaml_file diff --git a/_data/python-pfhub/pfhub/main.py b/_data/python-pfhub/pfhub/main.py index c46ddc840..b6ab388a8 100644 --- a/_data/python-pfhub/pfhub/main.py +++ b/_data/python-pfhub/pfhub/main.py @@ -103,18 +103,20 @@ def read_add_name(yaml_url): >>> assert read_add_name(getfixture('yaml_data_file').as_uri())['name'] == 'result' - >>> assert read_add_name(getfixture('yaml_data_file_with_name').as_uri())['name'] == 'result1' + >>> assert read_add_name( + ... getfixture('yaml_data_file_with_name' + ... ).as_uri())['name'] == 'result1' """ data = read_yaml_from_url(yaml_url) - if 'name' in data: + if "name" in data: return data - else: - return assoc( - read_yaml_from_url(yaml_url), - "name", - os.path.split(os.path.split(yaml_url)[0])[1], - ) + + return assoc( + read_yaml_from_url(yaml_url), + "name", + os.path.split(os.path.split(yaml_url)[0])[1], + ) def maybe(func): @@ -212,9 +214,7 @@ def concat_items(items): """ concat = lambda x: pandas.concat(x) if x != [] else None - return pipe( - items, map_(lambda x: assign(x[0], x[1])), compact, list, concat - ) + return pipe(items, map_(lambda x: assign(x[0], x[1])), compact, list, concat) @curry @@ -575,12 +575,11 @@ def read_vega_data(keys, data): read_values = sequence(get("values"), pandas.DataFrame) - return pipe( data, read_url if "url" in data else read_values, apply_transforms(data), - maybe(lambda x: get(keys, x)) + maybe(lambda x: get(keys, x)), ) From 5c36f6f85541d288a87b33d092cccf441ef7e76e Mon Sep 17 00:00:00 2001 From: Daniel Wheeler Date: Thu, 5 May 2022 16:13:19 -0400 Subject: [PATCH 3/4] ci: remove test for data app Data app test is breaking, but this will be discontinued very soon so not fixing. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 18ff575ea..4faa49fcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,6 @@ script: "; - nix-shell _apps/data/shell.nix --pure --command " cd _apps/data && - #py.test test.py && black --check *.py && pylint *.py && flake8 *.py From e09e40a203709853559469219ad7fea03c913ddb Mon Sep 17 00:00:00 2001 From: Daniel Wheeler Date: Fri, 6 May 2022 14:18:39 -0400 Subject: [PATCH 4/4] docs: clean up issue tempalates Clean up issue templates other than upload.yml, which will be dealt with later. --- .github/ISSUE_TEMPLATE/blank.md | 4 +++ .github/ISSUE_TEMPLATE/bug.yml | 31 ++---------------- .github/ISSUE_TEMPLATE/feature.yml | 51 ++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/web_bug.yml | 37 ++++++++++++++++++++++ 4 files changed, 95 insertions(+), 28 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/blank.md create mode 100644 .github/ISSUE_TEMPLATE/feature.yml create mode 100644 .github/ISSUE_TEMPLATE/web_bug.yml diff --git a/.github/ISSUE_TEMPLATE/blank.md b/.github/ISSUE_TEMPLATE/blank.md new file mode 100644 index 000000000..54a9971c4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank.md @@ -0,0 +1,4 @@ +--- +name: Blank Issue +about: Create an issue without a template +--- diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 89a085e98..639e40b5a 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,22 +1,14 @@ name: Bug Report description: File a bug report title: "[Bug]: " -labels: ["bug", "triage"] +labels: ["bug"] assignees: - - octocat + - wd15 body: - type: markdown attributes: value: | Thanks for taking the time to fill out this bug report! - - type: input - id: contact - attributes: - label: Contact Details - description: How can we get in touch with you if we need more info? - placeholder: ex. email@example.com - validations: - required: false - type: textarea id: what-happened attributes: @@ -26,16 +18,6 @@ body: value: "A bug happened!" validations: required: true - - type: dropdown - id: version - attributes: - label: Version - description: What version of our software are you running? - options: - - 1.0.2 (Default) - - 1.0.3 (Edge) - validations: - required: true - type: dropdown id: browsers attributes: @@ -46,17 +28,10 @@ body: - Chrome - Safari - Microsoft Edge + - N/A - type: textarea id: logs attributes: label: Relevant log output description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. render: shell - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 000000000..76909bae0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,51 @@ +--- +name: Feature Request +description: Suggest an idea to help improve PFHub +title: "[Feature]: " +labels: "enhancement" + +body: + - type: markdown + attributes: + value: | + **Thanks for taking the time to fill out this feature request + report!** We kindly ask that you search to see if an issue + [already exists](https://github.com/usnistgov/pfhub/issues) + for your feature. + + We are also happy to accept contributions from our users. For + more details see + [here](https://github.com/usnistgov/pfhub/blob/master/DEVELOPMENT.md). + + - type: textarea + attributes: + label: Description + description: | + A clear and concise description of the feature you're interested in. + validations: + required: true + + - type: textarea + attributes: + label: Suggested Solution + description: | + Describe the solution you'd like. A clear and concise description of what you want to happen. + validations: + required: true + + - type: textarea + attributes: + label: Alternatives + description: | + Describe alternatives you've considered. + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + + - type: textarea + attributes: + label: Additional Context + description: | + Add any other context about the problem here. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/web_bug.yml b/.github/ISSUE_TEMPLATE/web_bug.yml new file mode 100644 index 000000000..639e40b5a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/web_bug.yml @@ -0,0 +1,37 @@ +name: Bug Report +description: File a bug report +title: "[Bug]: " +labels: ["bug"] +assignees: + - wd15 +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: "A bug happened!" + validations: + required: true + - type: dropdown + id: browsers + attributes: + label: What browsers are you seeing the problem on? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - N/A + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell