linode / linode/docs

blueberry.py `valid_alias` not testing for uppercase or dashes in aliases as expected by test_frontmatter.py

Open
#1,923 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
1.2k
Avg merge
9m
Merged PRs (30d)
1

Description

`valid_alias`
https://github.com/linode/docs/blob/master/ci/blueberry.py#L107-L118

`test_frontmatter.py`
https://github.com/linode/docs/blob/master/ci/test_frontmatter.py#L27-L37

Errors from `test_frontmatter.py`:

```
(docs-pipenv-FgtCOWUg) nmelehan@localhost ~/D/l/docs> python -m pytest ci/
============================================================================================================ test session starts =============================================================================================================
platform darwin -- Python 3.6.5, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
rootdir: /Users/nmelehan/Desktop/linode/docs, inifile:
collected 9 items

ci/test_frontmatter.py ....FF. [ 77%]
ci/test_path.py . [ 88%]
ci/test_urls.py E [100%]

=================================================================================================================== ERRORS ===================================================================================================================
________________________________________________________________________________________________________ ERROR at setup of test_urls _________________________________________________________________________________________________________
file /Users/nmelehan/Desktop/linode/docs/ci/test_urls.py, line 4
def test_urls(edge_cases):
E fixture 'edge_cases' not found
> available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_xml_attribute, record_xml_property, recwarn, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.

/Users/nmelehan/Desktop/linode/docs/ci/test_urls.py:4
================================================================================================================== FAILURES ==================================================================================================================
____________________________________________________________________________________________________________ test_uppercase_alias ____________________________________________________________________________________________________________

def test_uppercase_alias():
with open('ci/data/SHOUTING_BAD_FILE.md','r') as f:
yaml = frontmatter.loads(f.read()).metadata

> assert valid_alias(yaml)[1] == "applications/containers/this-is-an-ALIAS/ should be lowercase."
E TypeError: 'NoneType' object is not subscriptable

ci/test_frontmatter.py:31: TypeError
___________________________________________________________________________________________________________ test_underscore_alias ____________________________________________________________________________________________________________

def test_underscore_alias():
with open('ci/data/underscore-alias.md','r') as f:
yaml = frontmatter.loads(f.read()).metadata

> assert valid_alias(yaml)[1] == "applications/containers/this_is_an_alias/ should use dashes instead of underscores."
E TypeError: 'NoneType' object is not subscriptable

ci/test_frontmatter.py:37: TypeError
================================================================================================ 2 failed, 6 passed, 1 error in 0.51 seconds =================================================================================================
```

Fix:
- [ ] Add test for uppercase aliases to `valid_alias`
- [ ] Add test for dashes in aliases to `valid_alias`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with valid_alias in ci/blueberry.py at lines 107-118 and the failing cases in ci/test_frontmatter.py at lines 27-37. Run python -m pytest ci/ and verify that uppercase and underscore aliases produce the expected validation messages; the unrelated test_urls fixture error is also shown in the reported run.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.