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

Refactor temporary test directory creation #195

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions .styleguide
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
}

cppSrcFileInclude {
\.cpp$
}

# Extra "/" used by unit tests
generatedFileExclude {
/cpplint\.py$
cpplint\.py$
}

modifiableFileExclude {
\.png$
}

licenseUpdateExclude {
Excluded\.h$
}

# Ordered this way to ensure tests find longest match
includeGuardRoots {
wpiformat/
wpiformat/Test/
}

# Used by unit tests
includeProject {
^ctre/
}
3 changes: 1 addition & 2 deletions .styleguide-license
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/*{padding}Company Name{padding}*/
/* Copyright (c) {year} Company Name. All Rights Reserved.{padding}*/
// Copyright (c) {year} FIRST
17 changes: 16 additions & 1 deletion wpiformat/wpiformat/test/test_cidentlist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from .test_tasktest import *
from .test_tempdir import *
from wpiformat.cidentlist import CIdentList


Expand Down Expand Up @@ -494,4 +495,18 @@ def test_cidentlist():
True,
)

test.run(OutputType.FILE)
with OpenTemporaryDirectory():
with open(".styleguide", "w") as file:
file.write(
r"""cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
}

includeProject {
^ctre/
}
"""
)
test.run(OutputType.FILE)
58 changes: 40 additions & 18 deletions wpiformat/wpiformat/test/test_config.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
import os

from .tempdir import *
from wpiformat.config import Config


def test_config():
config_file = Config(os.path.abspath(os.getcwd()), ".styleguide")
assert config_file.is_modifiable_file(
"." + os.sep + "wpiformat" + os.sep + "javaguidelink.png"
)
assert config_file.is_generated_file(
"." + os.sep + "wpiformat" + os.sep + "wpiformat" + os.sep + "cpplint.py"
)
with OpenTemporaryDirectory():
with open(".styleguide", "w") as file:
file.write(
r"""cppHeaderFileInclude {
\.h$
\.inc$
}

cppSrcFileInclude {
\.cpp$
}

# Extra "/" used by unit tests
generatedFileExclude {
/cpplint\.py$
}

modifiableFileExclude {
\.png$
}
"""
)

config_file = Config(os.path.abspath(os.getcwd()), ".styleguide")
assert config_file.is_modifiable_file(
"." + os.sep + "wpiformat" + os.sep + "javaguidelink.png"
)
assert config_file.is_generated_file(
"." + os.sep + "wpiformat" + os.sep + "wpiformat" + os.sep + "cpplint.py"
)

assert not config_file.is_generated_file(
"." + os.sep + "wpiformat" + os.sep + "diff_cpplint.py"
)
assert not config_file.is_generated_file(
"." + os.sep + "wpiformat" + os.sep + "update_cpplint.py"
)
assert not config_file.is_modifiable_file(
"." + os.sep + "wpiformat" + os.sep + "license.txt"
)
assert not config_file.is_generated_file(
"." + os.sep + "wpiformat" + os.sep + "diff_cpplint.py"
)
assert not config_file.is_generated_file(
"." + os.sep + "wpiformat" + os.sep + "update_cpplint.py"
)
assert not config_file.is_modifiable_file(
"." + os.sep + "wpiformat" + os.sep + "license.txt"
)
Loading
Loading