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

fix: elixir 17 & 18 compatibility #565

Merged
merged 94 commits into from
Jan 30, 2025

Conversation

ypconstante
Copy link
Contributor

@ypconstante ypconstante commented Jun 16, 2024

This PR replaces usages of Elixir functions that return random data, allowing us to update the test to work on all supported Elixir versions:

  • Replace Enum.random with :rand.uniform on Faker.Random.Test.random_between
  • Replace Enum.random with random_between on Faker.Random.Test.random_bytes
  • Replace Enum.take_random and Enum.shuffle with Enum.sort_by(random_uniform)

After this changes the only tests breaking was on Faker.File because of the map ordering changes on OTP 26, also fixed it and updated CI to test on both OTP 26 and 27.

I've added:

  • USAGE.md docs if applicable
  • CHANGELOG.md

@igas igas force-pushed the tests-compatible-elixir-1.17 branch 3 times, most recently from 02de2f6 to 814939e Compare January 30, 2025 11:09
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

{:ok, count, fun} when is_function(fun, 1) ->
slice_list(fun.(enumerable), random_count(count), 1, 1)

# TODO: Deprecate me in Elixir v1.18.

Check warning

Code scanning / Credo

Found a TODO tag in a comment: # TODO: Deprecate me in Elixir v1.18. Warning test

Found a TODO tag in a comment: # TODO: Deprecate me in Elixir v1.18.
@igas igas force-pushed the tests-compatible-elixir-1.17 branch 2 times, most recently from 71990e5 to d3838ec Compare January 30, 2025 11:19
@igas igas force-pushed the tests-compatible-elixir-1.17 branch from d3838ec to 87c8420 Compare January 30, 2025 11:23
@igas igas force-pushed the tests-compatible-elixir-1.17 branch from af2c3a5 to ed0813e Compare January 30, 2025 11:49
@igas igas changed the title Make tests compatible with Elixir 1.16 and 1.17 fix: elixir 17 & 18 compatibility Jan 30, 2025
@igas igas merged commit f3d4808 into elixirs:master Jan 30, 2025
5 checks passed
@nathany-copia
Copy link

Thanks. Will there be a release to hex?

igas pushed a commit that referenced this pull request Jan 31, 2025
## [0.19.0-alpha.1](v0.18.0...v0.19.0-alpha.1) (2025-01-31)

### Features

* add release automation ([#581](#581)) ([0d08ed2](0d08ed2))

### Bug Fixes

* **deps:** add missing @semantic-release/exec ([#584](#584)) ([bfea5c4](bfea5c4))
* **ci:** add workflow_call ([#586](#586)) ([c25f43e](c25f43e))
* **ci:** allow write ([#590](#590)) ([d49419a](d49419a))
* elixir 17 & 18 compatibility ([#565](#565)) ([f3d4808](f3d4808))
* elixir deprecations ([#571](#571)) ([b7e4af0](b7e4af0))
* **ci:** permissions ([#591](#591)) ([d78c8f1](d78c8f1))
* remove nil option for Airports IATA ([#492](#492)) ([59951ec](59951ec))
* **ci:** typo in workflow path ([#585](#585)) ([8ed49eb](8ed49eb))
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.

3 participants