Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for --document-hidden-items option #113857

Merged
merged 2 commits into from
Jul 20, 2023

Conversation

GuillaumeGomez
Copy link
Member

Since --document-hidden-items was greatly fixed/improved in #113574, thought it might be worth adding some more tests for it to prevent new regressions.

As for the first commit, it allows to go from:

Traceback (most recent call last):
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 706, in <module>
    check(sys.argv[1], get_commands(rust_test_path))
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 689, in check
    for c in commands:
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 274, in get_commands
    args = shlex.split(args)
  File "/usr/lib/python3.10/shlex.py", line 315, in split
    return list(lex)
  File "/usr/lib/python3.10/shlex.py", line 300, in __next__
    token = self.get_token()
  File "/usr/lib/python3.10/shlex.py", line 109, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.10/shlex.py", line 191, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation

to:

Traceback (most recent call last):
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 708, in <module>
    check(sys.argv[1], get_commands(rust_test_path))
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 691, in check
    for c in commands:
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 278, in get_commands
    raise Exception("line {}: {}".format(lineno + 1, exc)) from None
Exception: line 57: No closing quotation

Having the line where the error occurred is quite useful.

r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 19, 2023
@GuillaumeGomez GuillaumeGomez force-pushed the document-hidden-items-test branch from cbb42c7 to d9753d7 Compare July 19, 2023 12:34
@@ -274,6 +274,8 @@ def get_commands(template):
args = shlex.split(args)
except UnicodeEncodeError:
args = [arg.decode('utf-8') for arg in shlex.split(args.encode('utf-8'))]
except Exception as exc:
raise Exception("line {}: {}".format(lineno + 1, exc)) from None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The from None part is to go from:

Traceback (most recent call last):
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 274, in get_commands
    args = shlex.split(args)
  File "/usr/lib/python3.10/shlex.py", line 315, in split
    return list(lex)
  File "/usr/lib/python3.10/shlex.py", line 300, in __next__
    token = self.get_token()
  File "/usr/lib/python3.10/shlex.py", line 109, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.10/shlex.py", line 191, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 708, in <module>
    check(sys.argv[1], get_commands(rust_test_path))
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 691, in check
    for c in commands:
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 278, in get_commands
    raise Exception("line {}: {}".format(lineno, exc))
Exception: line 56: No closing quotation

to:

Traceback (most recent call last):
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 708, in <module>
    check(sys.argv[1], get_commands(rust_test_path))
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 691, in check
    for c in commands:
  File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 278, in get_commands
    raise Exception("line {}: {}".format(lineno + 1, exc)) from None
Exception: line 57: No closing quotation

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 19, 2023

📌 Commit d9753d7 has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 19, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 20, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#113710 (Fix rpath for libdir is specified)
 - rust-lang#113787 (Update documentation for std::process::Command's new method)
 - rust-lang#113795 (Properly document `lifetime_mapping` in `OpaqueTy`)
 - rust-lang#113857 (Add tests for `--document-hidden-items` option)
 - rust-lang#113871 (Use the correct span for displaying the line following a derive sugge…)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 53580da into rust-lang:master Jul 20, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 20, 2023
@GuillaumeGomez GuillaumeGomez deleted the document-hidden-items-test branch July 20, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants