Skip to content

Conversation

@gepbird
Copy link
Contributor

@gepbird gepbird commented Feb 4, 2025

Previously some tests failed with dotnet test OpenTabletDriver.Tests --configuration Release --runtime linux-x64, because the current working directory was bin/Release/linux-x64 directory instead of the usual bin/Release, and it couldn't find the configuration directory in the ../../../.. path.

This PR prioritizes reading the config directory from an environment variable already used in other files.

@jamesbt365
Copy link
Member

Hey, you should give our CONTRIBUTING.md a read, you should not be PRing to master at this time. Either target our stable branch (0.6.x) or our UI rewrite (avalonia)

@jamesbt365 jamesbt365 marked this pull request as draft February 4, 2025 16:11
@gepbird
Copy link
Contributor Author

gepbird commented Feb 4, 2025

Sorry about that, I only read the Code Contribution section where it states that I should PR to master.

At the top I see it mentioning the 0.6.x branch, I'll target that in a sec.

@gepbird gepbird force-pushed the improve-tablet-detection-in-test branch from ce76011 to 5f6f56f Compare February 4, 2025 16:19
@gepbird gepbird changed the base branch from master to 0.6.x February 4, 2025 16:20
@jamesbt365 jamesbt365 added configuration Adds or modifies a tablet configuration tests Adds or modifies a unit test labels Feb 4, 2025
@gepbird gepbird marked this pull request as ready for review February 4, 2025 16:23
@gepbird gepbird changed the title Improve config dir detection in tests [0.6.x] Improve config dir detection in tests Feb 4, 2025
Copy link
Member

@gonX gonX left a comment

Choose a reason for hiding this comment

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

Assuming the intent is to include support of the OTD_CONFIGURATIONS environment variable, wouldn't it be more interesting to instead change the existing ConfigurationDir variable to

Environment.GetEnvironmentVariable("OTD_CONFIGURATIONS")
                ?? Path.Join(ConfigurationProjectDir, "Configurations");

This would make this change a one, maybe 2 line change instead of this.

@gonX
Copy link
Member

gonX commented Feb 8, 2025

You can alternatively use the [CallerFilePath] attribute on a helper function to help figure out the root directory for the Configurations project.

@gepbird gepbird force-pushed the improve-tablet-detection-in-test branch from 5f6f56f to 2829c76 Compare February 8, 2025 17:35
@gepbird
Copy link
Contributor Author

gepbird commented Feb 8, 2025

You can alternatively use the [CallerFilePath] attribute on a helper function to help figure out the root directory for the Configurations project.

This is almost exactly what I was looking for, great find and thanks!

Assuming the intent is to include support of the OTD_CONFIGURATIONS environment variable

My main intent is to make the tests pass when called with the extra argument --runtime linux-x64 that we use for every dotnet package in nix. I'll remove the env variable in favor of CallerFilePath, but we can keep it as a fallback if you think it could be useful later.

This would make this change a one, maybe 2 line change instead of this.

I agree, I mostly changed it because those variables didn't have any other references and it was subjectively more readable to me.

@gonX
Copy link
Member

gonX commented Feb 8, 2025

I liked the idea of also supporting OTD_CONFIGURATIONS but this is fine as well.

@gonX gonX merged commit d9a6362 into OpenTabletDriver:0.6.x Feb 8, 2025
9 checks passed
@gepbird gepbird deleted the improve-tablet-detection-in-test branch February 8, 2025 19:05
@gonX gonX added this to the v0.6.5.2 milestone Aug 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Adds or modifies a tablet configuration tests Adds or modifies a unit test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants