Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

All test reported as skipped if not applicable to the platform#2892

Merged
mirichmo merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:testsiswindowsiSazonov/PowerShell:testsiswindowsCopy head branch name to clipboard
Jan 4, 2017
Merged

All test reported as skipped if not applicable to the platform#2892
mirichmo merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:testsiswindowsiSazonov/PowerShell:testsiswindowsCopy head branch name to clipboard

Conversation

@iSazonov

@iSazonov iSazonov commented Dec 15, 2016

Copy link
Copy Markdown
Collaborator

Close #2887

Fixed files:

powershell\Modules\Microsoft.PowerShell.Management\Clear-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\Get-ComputerInfo.Tests.ps1:1325:
return

powershell\Modules\Microsoft.PowerShell.Management\Get-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\New-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:7:
if ($IsWindows -eq $false) {

powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:167:
if ($IsWindows -eq $false) {

powershell\Modules\Microsoft.PowerShell.Management\Remove-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\TimeZone.Tests.ps1:17:if
($IsWindows) {

powershell\Modules\Microsoft.PowerShell.Security\FileCatalog.Tests.ps1:6:if
($IsWindows) {

powershell\engine\Help\HelpSystem.Tests.ps1:112: if ($IsWindows)

@iSazonov iSazonov changed the title All test reorted as skipped if not applicable to the platform All test reported as skipped if not applicable to the platform Dec 15, 2016
@lzybkr lzybkr requested a review from JamesWTruher December 15, 2016 19:33
@PowerShellTeam PowerShellTeam added the Review - Needed The PR is being reviewed label Dec 15, 2016
@iSazonov iSazonov force-pushed the testsiswindows branch 9 times, most recently from 208bfcd to 1cb266e Compare December 16, 2016 18:18
Fixed files:

powershell\Modules\Microsoft.PowerShell.Management\Clear-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\Get-ComputerInfo.Tests.ps1:1325:
return

powershell\Modules\Microsoft.PowerShell.Management\Get-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\New-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:7:
if ($IsWindows -eq $false) {

powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:167:
if ($IsWindows -eq $false) {

powershell\Modules\Microsoft.PowerShell.Management\Remove-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\TimeZone.Tests.ps1:17:if
($IsWindows) {

powershell\Modules\Microsoft.PowerShell.Security\FileCatalog.Tests.ps1:6:if
($IsWindows) {

powershell\engine\Help\HelpSystem.Tests.ps1:112: if ($IsWindows)

@mirichmo mirichmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR. This is a helpful and needed contribution.

helpContext = "[@id='FileSystem' or @ID='FileSystem']"
verb = 'Add'
noun = 'Content'
pending = if ($IsWindows) { $false } else { $true }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about
pending = !$IsWindows
instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

$originalTimeZoneId
BeforeAll {
$originalTimeZoneId = (Get-TimeZone).Id
if ($IsWindows) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The pattern is inconsistent here. Can you please keep consistency and use $IsNotSkipped here as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

😕 $IsNotSkipped is not used anywhere in the file. I do not see inconsistent here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The file is internally consistent, so it passes review. I was thinking about more consistent application of skipping patterns across all test files. The reason I favor $IsNotSkipped over $IsWindows is that $IsNotSkipped enables a single definition of the skipping condition, so any future modifications of it happen via a single line change. Using or modifying $IsWindows requires modifying every use of it throughout the file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Our direction is porting, i.e. skipping tests must generally be disappear in the future and $IsWindows and $IsNotSkipped should stay in the past :-)


BeforeAll {
$defaultParamValues = $PSdefaultParameterValues.Clone()
$IsNotSkipped = ($IsWindows -and !$IsCoreCLR)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is IsNotSkipped used anywhere else? If not, it should be removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed


BeforeAll {
$defaultParamValues = $PSdefaultParameterValues.Clone()
$IsNotSkipped = ($IsWindows -and !$IsCoreCLR)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

New-Item -Path $testKey > $null
New-Item -Path $testKey2 > $null
New-ItemProperty -Path $testKey -Name $testPropertyName -Value $testPropertyValue > $null
if ($IsWindows) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have a preference for $IsNotSkipped here since it is easier to read. It will also maintain consistency across this PR

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

😕 $IsNotSkipped is not used anywhere in the file. There is no need to create a variable to use it once. Yes?
And in general there is no overall style between these files. Each file has its own style.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking at this more closely, I'd like to see the try-finally technique used to surround both Describes (like you did in FileCatalog.Tests.ps1). It'll result in the de-duplication of a few lines and more complete grouping of actions in the BeforeAll and AfterAll blocks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.


AfterAll {
#restore the previous environment
Set-Location -Path $restoreLocation

@mirichmo mirichmo Jan 3, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is one of the spots I had in mind when I mentioned "more complete grouping of actions...". A principle I'd like the tests to follow: if a Describe is being skipped, it should not do anything. In this case, it is saving and restoring the location; an action that can be bypassed with if ($IsNotSkipped). It won't happen in this specific instance, but I'd like to protect against skipped tests accidentally causing side-effects for other tests.

@iSazonov iSazonov Jan 4, 2017

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Clear. Thanks!
(My policy was to preserve original test style and add minimal changes.)

Fixed.

@mirichmo mirichmo self-assigned this Jan 3, 2017
@mirichmo mirichmo merged commit 124979b into PowerShell:master Jan 4, 2017
@iSazonov

iSazonov commented Jan 4, 2017

Copy link
Copy Markdown
Collaborator Author

@mirichmo Thanks for the code review and useful comments!

@iSazonov iSazonov deleted the testsiswindows branch January 5, 2017 17:43
rjmholt pushed a commit to rjmholt/PowerShell that referenced this pull request Jan 9, 2017
…Shell#2892)

* All test reported as skipped if not applicable to the platform

Fixed files:

powershell\Modules\Microsoft.PowerShell.Management\Clear-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\Get-ComputerInfo.Tests.ps1:1325:
return

powershell\Modules\Microsoft.PowerShell.Management\Get-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\New-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:7:
if ($IsWindows -eq $false) {

powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:167:
if ($IsWindows -eq $false) {

powershell\Modules\Microsoft.PowerShell.Management\Remove-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {

powershell\Modules\Microsoft.PowerShell.Management\TimeZone.Tests.ps1:17:if
($IsWindows) {

powershell\Modules\Microsoft.PowerShell.Security\FileCatalog.Tests.ps1:6:if
($IsWindows) {

powershell\engine\Help\HelpSystem.Tests.ps1:112: if ($IsWindows)

* Fix test after code review

* Move skiping to common 'try'
@iSazonov iSazonov removed the Review - Needed The PR is being reviewed label Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.